C#/WPF: Add Window.Style, even if a ResourceDictionary already exists
-
16-09-2019 - |
Question
I'm trying to add two Datatriggers to my WPF Window. Normally, this would work via adding
`<Style TargetType="{x:Type TextBlock}"></Style>`
to the Window.Resources. In this case, I already have
`<ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />`
in it. Is there a way to override the definitions from there?
Thanks a lot!
Cheers
Solution
Try this:
<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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow