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)
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.