大家好我这个问题
我有这个资源字典
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
<SolidColorBrush x:Key="IconsBrush" x:Name="IconBrush" Color="#FF090909"/>
<Canvas x:Key="NoState" HorizontalAlignment="Left" Height="204.789368" UseLayoutRounding="False" VerticalAlignment="Top" Width="204.8125" x:Shared="false">
<Path x:Name="NoStateX" Data="F1M121.621,0L72.125,49.496 22.625,0 0,22.625 49.496,72.125 0,121.621 22.625,144.25 72.125,94.75 121.621,144.25 144.25,121.621 94.75,72.125 144.25,22.625z"
Height="144.25" Canvas.Left="30.281" Canvas.Top="29.484" Width="144.25"/>
<Path x:Name="NoStateCircle" Data="M199.726,102.402C199.726,156.152 156.152,199.727 102.402,199.727 48.648,199.727 5.074,156.152 5.074,102.402 5.074,48.649 48.648,5.074 102.402,5.074 156.152,5.074 199.726,48.649 199.726,102.402z"
Stroke="#FF44A8E4" StrokeThickness="10.148" StrokeLineJoin="Round"
Height="204.801" Canvas.Left="0.004" Canvas.Top="-0.793" Width="204.8"/>
问题是: 可以传递属性而不是值,所以当合并字典时,我可以传递此属性中的值,如此vay:
<SolidColorBrush x:Key="IconsBrush" x:Name="IconBrush" Color="{Binding MyPropertyColor}"/>
从另一个我将合并这个词典的程序集中我传递了这个模式的值:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MyAssemblyName;component/Themes/MYResourcesDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
<MyResourcesDictionary.MyPropertyColor="Color.Black"/>
</ResourceDictionary>
</UserControl.Resources>