问题描述
我有一个定义自定义主题词典的按钮。
<Button Content="Expand Slot"
FontWeight="SemiBold"
Command="{Binding ElementName=ThisPage,Path=ViewModel.NavigateToSlot,Mode=OneWay}"
CommandParameter="{x:Bind SlotNumber,Mode=OneWay}">
<Button.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<!--Default colors-->
<SolidColorBrush x:Key="ButtonBackground" Color="Transparent"/>
<SolidColorBrush x:Key="ButtonForeground" Color="DarkSlateBlue"/>
<SolidColorBrush x:Key="ButtonBorderBrush" Color="DarkSlateBlue"/>
<!--Mouseover colors-->
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="Transparent"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="MediumSlateBlue"/>
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="MediumSlateBlue"/>
<!--Colors while being clicked-->
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="Transparent"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="MediumSlateBlue"/>
<SolidColorBrush x:Key="ButtonBorderBrushPressed" Color="MediumSlateBlue"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Button.Resources>
</Button>
这很好用,但是我希望能够在多个按钮之间使用相同的Dictionary,而不必编辑每个按钮的<Button.Resources>
<Button Content="Button 1">
<Button.Resources>
-- Apply my colors --
</Button.Resources>
</Button>
<Button Content="Button 2">
<Button.Resources>
-- Apply my colors --
</Button.Resources>
</Button>
在UWP中执行此操作的正确方法是什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)