2
有没有办法在运行时替换WPF应用程序的所有画笔定义,并且只声明一次使用它的样式?这对于不同的配色方案会很有用,但保留相同的用户界面并声明一次。我可以找到所有的例子在不同的主题文件中重复样式 - 这是唯一的方法吗?如何在WPF应用程序中应用不同的配色方案
小例子:
Blue.xaml
<SolidColorBrush x:Key="DefaultBackgroundBrush" Color="Blue"/>
Yellow.xaml
<SolidColorBrush x:Key="DefaultBackgroundBrush" Color="Yellow"/>
generic.xaml?
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="{StaticResource DefaultBackgroundBrush}" />
</Style>