If Resources dictionary is not observable, how does DynamicResource reference work? Do the Add / Remove methods of the resource dictionary have internal code that kind of "polls" all DynamicResource references and refreshes them when they are removed or added?
How does ResourceDictionary change result in DynamicResource reevaluation?
Asked Answered
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.
© 2022 - 2024 — McMap. All rights reserved.