Page 1 of 1

How to Update GUI after SetApplicationResources

Posted: 25 Sep 2020, 13:45
by Noa3
Hi how do i update the whole Gui from noesis after i load a new resource Dictionary like this:
newRes = (ResourceDictionary)GUI.LoadXaml("Assets/_Game/Gui/Menu/ResourceDictionary/Theme.DarkBlue.xaml");
and set the Global Style with
Noesis.GUI.SetApplicationResources(newRes);
which method i need to call after set, this to see the changes?

Re: How to Update GUI after SetApplicationResources

Posted: 28 Sep 2020, 10:53
by sfernandez
Hi, I verified that changes made to ApplicationResources or its dictionary are not notified to the tree. This is a deviation from WPF, could you please report it?

Anyway, I want to clarify that if your UI elements are using StaticResources then changes to the ApplicationResources won't be reflected until you reload the entire UI, because StaticResources are locally set in the controls. If you need your controls to be updated when ApplicationResources is modified, you have to use DynamicResources.

For example, our NoesisTheme uses DynamicResources for all the brushes and some other resources, so we are able to set a new dictionary (as part of the UI tree) with different color brushes to update the appearance of the UI. We do this in our Gallery application: https://github.com/Noesis/Tutorials/tre ... es/Gallery