Home > Mobile >  How to create and change app theme in XAML
How to create and change app theme in XAML

Time:12-01

I am creating a calculator in WPF and I want to do some themes like light-mode, green-mode and etc. I have menu with options to set theme, and when somebody clicks 'green-mode' the theme should change for green. I don't know how to start. I want to do it professionally so I think everything should be in XAML. I heard about <ResourceDictionary.ThemeDictionaries> and Material Design library. Do you have an idea how to start or what should I read about, any technologies?

CodePudding user response:

Theming is an extensive topic and there are many resources on this topic out there. Your question actually has two components: how to create a theme, and subsequently, how to have multiple themes and dynamically switch between them.

As for creating themes, I think your best bet would be to take a close look at other themes out there. A theme typically resides in one or more resource dictionaries. A quick search got me this:

Then once you have your themes, add functionality to switch:

  • Related