开发者

How to force WPF UI element to use resources from the theme, ignoring app's resources

开发者 https://www.devze.com 2022-12-18 16:57 出处:网络
Is there a way to make a WPF element use (explicitly or implicitly) the resources located in themes even if app.xaml provides resources with the same \'key\'-s?

Is there a way to make a WPF element use (explicitly or implicitly) the resources located in themes even if app.xaml provides resources with the same 'key'-s?

I have all of the default controls restyled, and all those styles are merged to the app's ResourceDictionary. Now I have one single XAML file that has a single element which I'd like to be styled using system's defaults. Is it poss开发者_如何学Cible?


I've found a solution.

I can apply system theme for that single element in the resource, something like this:

<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>                
        <ResourceDictionary 
            Source="/PresentationFramework.Aero;V3.0.0.0;31bf3856ad364e35;component\themes/aero.normalcolor.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
0

精彩评论

暂无评论...
验证码 换一张
取 消