开发者

Binding Resource to DependencyProperty

开发者 https://www.devze.com 2023-01-27 23:42 出处:网络
I am building a CustomControl that must unfortunately contain a poorly built sub-control to which I have neither the code, nor the ability to re-template (internal yada, yada). I do however have acces

I am building a CustomControl that must unfortunately contain a poorly built sub-control to which I have neither the code, nor the ability to re-template (internal yada, yada). I do however have access to change its resources, which leaves me with the following question:

If I want to expose a dependencyProperty on my new CustomControl that changes the v开发者_如何转开发alue of a resource (Brush), is it better to make a PropertyChangedCallback that sets the resource explicitly, or to create a binding to the DP and set the resource to the binding.

I'm sure it doesn't make a huge difference in performance, but what is the 'right' way to go?

Thank you kindly.


@ach:-

Right now your requirement is to change Brush and may be in future you may need to do othere thing on that, so it will be better to make a PropertyChangedCallback that sets the resource and will do other stuff.

0

精彩评论

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