开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜