我有一个WPF应用程序。这是存储在App.xaml中的应用程序资源:
<Application.Resources>
<SolidColorBrush
x:Key="wineRedBrush"
Color="#B0324F" />
<SolidColorBrush
x:Key="orangeBrush"
Color="#F9694B" />
<SolidColorBrush
x:Key="lightGray"
Color="#D4D4D4" />
<SolidColorBrush
x:Key="darkGray"
Color="#A8A8A8" />
</Application.Resources>我希望从Generic.xaml中的应用程序资源中获取我的Generic.xaml刷:
<Separator
Grid.Column="2"
Background="{StaticResource ResourceKey=wineRedBrush}"
VerticalAlignment="Center"
Margin="10,4,12,0" />但资源却找不到,为什么?有可能拿到吗?
发布于 2013-10-16 14:39:41
你试过使用DynamicResource而不是StaticResource吗?
<Separator
Grid.Column="2"
Background="{DynamicResource wineRedBrush}"
VerticalAlignment="Center"
Margin="10,4,12,0" />https://stackoverflow.com/questions/19405986
复制相似问题