Reputation: 33
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)
Upvotes: 1
Views: 170
Reputation: 6260
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
Upvotes: 1