Replies: 3 comments 1 reply
-
I don't know how to solve this specific problem, but a possible work around is to just embed the resource dictionary itself and then load it using the https://docs.avaloniaui.net/docs/basics/user-interface/assets You can then reference it from within your normal XAML. |
Beta Was this translation helpful? Give feedback.
-
Option 1: you can define a class behind ResouceDictionary, then you can just construct it in code. Example https://github.com/irihitech/Semi.Avalonia/tree/main/src/Semi.Avalonia/Locale Option 2: use AvaloniaRuntimeXamlLoader |
Beta Was this translation helpful? Give feedback.
-
Try add this to your App.axmal |
Beta Was this translation helpful? Give feedback.
-
I created a c# class project where i added an AvaloniaResourceDictionary called Strings.fr.axaml which contains some system strings:
i also add the AvaloniaResource as an itemgroup:
I can now build the project which will generate a dll.
in the App.axaml.cs file i added the following function:
In ILSpy i see this:
Unfortunately i am unable to load the ResourceDictionary so that the binding in the textblock below does not work:
<TextBlock Text="{DynamicResource Goodbye}" Background="Red"/>
Can anyone please help on how to load the dll and fetch the resourcedictionary correctly?
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions