【问题标题】:C#/WPF: Add Window.Style, even if a ResourceDictionary already existsC#/WPF:添加 Window.Style,即使 ResourceDictionary 已经存在
【发布时间】:2009-07-16 13:46:54
【问题描述】:

我正在尝试将两个 Datatrigger 添加到我的 WPF 窗口中。通常,这可以通过添加

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

到 Window.Resources。 在这种情况下,我已经有了

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

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

非常感谢!

干杯

【问题讨论】:

    标签: c# wpf styles resourcedictionary


    【解决方案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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-09
      • 1970-01-01
      • 2016-05-29
      • 2022-01-24
      相关资源
      最近更新 更多