Change theme at runtime

前端 未结 5 824
一向
一向 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:38

    Here is an article that will walk you through it:

    http://svetoslavsavov.blogspot.com/2009/07/switching-wpf-interface-themes-at.html

    Basically you need to remove the "old" theme from the resource dictionary and then merge in the new one. The above article shows you how to make this change very simple.

提交回复
热议问题