开发者

how to achieve Value inheritance of DP in silverlight?

how to achieve Value inheritance of DP in silverlight, or is there any way to share a property value of pare开发者_JAVA技巧nt with children, Datacontext cant be shared in my case.


You are going to have to write code to handle this yourself.

Some existing API types such as the UIElement->FrameworkElement->Control heirarchy do implement some form of "value inheritance" such as FontFamily etc. However it's code inside these types which handles this, there is no general mechanism present to support the concept.


I have done this little differently, I have tried to set Binding for property to it's parent's same property in the constructor. So after the object is created if you set an explicit value, binding will be removed. Otherwise it is bound to Parent's x property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜