riacosta
Topic Author
Posts: 2
Joined: 17 Sep 2020, 14:11

Loading a Resource Dictionary programmatically.

27 Jan 2021, 22:09

I'm trying to load a resource dictionary from code. I've tried using GUI.LoadXaml(path) and GUI.LoadXamlResource(path) but I can't even getto pass a path that finds the resource.
Do you guys have an example of this by any chance?

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 2056
Joined: 22 Dec 2011, 19:20

Re: Loading a Resource Dictionary programmatically.

01 Feb 2021, 17:43

We use that in our Localization sample:
Resources = (ResourceDictionary)Noesis.GUI.LoadXaml("Assets/NoesisGUI/Samples/Localization/Language-en.xaml")
But make sure that the xaml dictionary is referenced from any other loaded asset. You can do that by explicitly adding a dependency in one of your root xamls:
<noesis:Xaml.Dependencies>
  <noesis:Dependency Source="Language-en.xaml"/>
</noesis:Xaml.Dependencies>

Who is online

Users browsing this forum: No registered users and 1 guest