Reusing DPs
-
8. srpna 2012 22:02
Hello,
I am using two BarSeries, each has a ShowLabels property on them. I would like to expose that property through the VM, so that they both hinge on one property. This property would then get binded to upstream. Right now I am creating a new DP with the same name and binding both BarSeries to it, although I noticed an option on the existing DP to "Add an Owner" to it. What is the best way of accomplishing this?
Thanks,
Eric
Všechny reakce
-
8. srpna 2012 23:56Moderátor
You are right to bind them both to the same public property in the VM.
That could be a dependency property, or a public property of a class that implements INotifyPropertyChanged.
I'm not sure the default binding mode for the ShowLabels property (I suspect you may not need to) but you can set the binding mode to OneWay, to be sure. So they only "pull" the value FROM the VM, not set it back again.
The Owner of the DP is the control it belongs to, I don't believe you can use this to share properties, if that's what you mean?
Regards,
Pete#PEJL
- Označen jako odpověď Eric Kulcyk 9. srpna 2012 4:48