Now I have a question a little more complicated.
How do I get the parent element of an object.
For example:
<Viewbox>
<TextBlock Name="txtblock1" />
</Viewbox>
How do i get, via code (c#), the parent element of “txtblock1” ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the
Parentproperty. The parent is returned as anObjectso you’ll need to cast it to be able to callViewbox‘s methods.For example: