1

How can I create a binding to a property defined in an UserControl from XAML which includes it? For example, I have a control of type local:Photo named thePhoto, which has three controls local:Layer called Main, Frame and Text, and I want to access thePhoto.Main.ActualWidth from my MainWindow? Thanks

(I forgot to say that simple Binding with Path and ElementName doesn't work)

1 Answer 1

1

Create DependencyProperty of desired type within "parent" UserControl and bind it with needed Properties on both sides.
Nice example of doing stuff like that: Exploring the use of Dependency Properties in User Controls

Sign up to request clarification or add additional context in comments.

1 Comment

Oh, thanks a lot! Now I see... How complicated! The author himself slams the mechanism... BTW, as far as I see, he only binds to predefined properties (like SelectedItem), which is not the case in my question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.