2009-07-16 76 views
0

我想添加两个Datatriggers到我的WPF窗口。通常,这可以通过向Window.Resources添加C#/ WPF:添加Window.Style,即使ResourceDictionary已经存在

`<Style TargetType="{x:Type TextBlock}"></Style>`  

来工作。 在这种情况下,我已经有

`<ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />` 

在里面。有没有办法覆盖那里的定义?

非常感谢!

干杯

回答

1

试试这个:

<ResourceDictionary> 
    <ResourceDictionary.MergedDictionaries> 
    <ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml"/> 
    </ResourceDictionary.MergedDictionaries> 
    <!-- Other stuff here --> 
    <Style .../> 
</ResourceDictionary> 
+0

太好了!这工作。谢谢。 – 2009-07-16 14:18:35