WPF, Setting property with single value on multiple subcontrols
Posted
by Andre van Heerwaarde
on Stack Overflow
See other posts from Stack Overflow
or by Andre van Heerwaarde
Published on 2010-04-25T21:21:50Z
Indexed on
2010/04/25
21:23 UTC
Read the original article
Hit count: 280
I have a parent contentcontrol which displays data via a datatemplate. The datatemplate contains a stackpanel with several usercontols of the same type. I like to set the property only once on the parent control, it must set the value of the property on all the subcontrols. But if there is a way to do it on the stackpanel it's also OK. The template can be changed at runtime and the values need also to be propagated to the new template.
My current solution is to implement the property on both parent and subcontrol and use code to propagate the value from the parent to all the subcontrols. My question is: is there a better or other ways of doing this?
© Stack Overflow or respective owner