- MattNiznak
- Posts: 8
- Joined:
Preload resource dictionary and change resource dictionary at runtime.
I'm still on Noesis 2.2.
The method I'm using for loading elements is that elements are dynamically generated based on other data... so elements have their own XAML and are loaded without hierarchy. They are then attached to a parent. If I load this way, they load before parented and don't inherit the resource dictionary of their parent.
I could add the resource dictionary file to every element xaml, but then there is a significant slowdown as each element loads their own copy of the resource dictionary. I want to be able to load resource dictionary at the start of the program and attach it to elements later. I've tried using the SetResource() function, but that doesn't seem to change anything. I was wondering if I was missing something.
The method I'm using for loading elements is that elements are dynamically generated based on other data... so elements have their own XAML and are loaded without hierarchy. They are then attached to a parent. If I load this way, they load before parented and don't inherit the resource dictionary of their parent.
I could add the resource dictionary file to every element xaml, but then there is a significant slowdown as each element loads their own copy of the resource dictionary. I want to be able to load resource dictionary at the start of the program and attach it to elements later. I've tried using the SetResource() function, but that doesn't seem to change anything. I was wondering if I was missing something.
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: Preload resource dictionary and change resource dictionary at runtime.
You should use the Application Resources, a global dictionary loaded at application startup that is accessed by all the xamls you load later: https://www.noesisengine.com/docs/Gui.C ... -resourcesI want to be able to load resource dictionary at the start of the program and attach it to elements later.
This is because you are probably using StaticResources, that resolve when xaml is parsed. If you use DynamicResource then they will update when connected to a different parent.Elements have their own XAML and are loaded without hierarchy. They are then attached to a parent. If I load this way, they load before parented and don't inherit the resource dictionary of their parent.
Who is online
Users browsing this forum: Dmirty, Google [Bot] and 4 guests