开发者

How does ResourceDictionary change result in DynamicResource reevaluation?

开发者 https://www.devze.com 2023-03-26 08:19 出处:网络
If Resources dictionary is not observable, how does DynamicResource reference work? Do the Add / Remove methods of the r开发者_如何学运维esource dictionary have internal code that kind of \"polls\" al

If Resources dictionary is not observable, how does DynamicResource reference work? Do the Add / Remove methods of the r开发者_如何学运维esource dictionary have internal code that kind of "polls" all DynamicResource references and refreshes them when they are removed or added?


Each ResourceDictionary contains three list of owners. One for FrameworkElement, one for Application and another one for FrameworkContentElement. When you access the Resources property the owner is being set. Also each ResourceDictionary propagates its owner to merged dictionaries. When dictionary is changing, it notifies owners about it. This notification actually searches dependency properties with local values containing resource expression. Then each expression is forced to reevaluate.

All of this code is internal.

0

精彩评论

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