Change theme at runtime

前端 未结 5 846
一向
一向 2020-11-30 01:48

I have a WPF application with a theme (ShinyRed.xaml) and I want to have a button that when clicked changes the theme to ShinyBlue.xaml

I load in the theme initially

5条回答
  •  广开言路
    2020-11-30 02:24

    Im using the following command to set the theme at runtime:

    Application.Current.Resources.Source = new Uri("/Themes/ShinyRed.xaml", UriKind.RelativeOrAbsolute);
    

提交回复
热议问题