Hello, how to go from:
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="teste.App">
<Application.Resources>
<!-- Resources scoped at the Application level should be defined here. -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
**<ResourceDictionary Source="Green.xaml"/>**
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
To:
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="teste.App">
<Application.Resources>
<!-- Resources scoped at the Application level should be defined here. -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
**<ResourceDictionary Source="Blue.xaml"/>**
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Dynamically, when users choose the theme… Is it possible?
Thank you
Josi
You could change the resource dictionary dynamically in the code behind, on the load of the page.xaml:
Application:
Then once you have the resource dictionary you can apply it using simple logic:
NB: [Assembly] is the namespace of the component where the xaml file exists.
Then merge it into the dictioanry for the page with: