Home > OS >  How to assign TemplatedParent Content property to a variable?
How to assign TemplatedParent Content property to a variable?

Time:12-06

I have this code where the user clicks on a List Box Item and I try to get the Content property of TemplatedParent assigned into a variable to check later, but I get this error:

Code preview

enter image description here

enter image description here

How can I assign the content value to a variable?

CodePudding user response:

You have to pass a DependencyProperty to GetValue so replace Content with ContentControl.ContentProperty

  • Related