Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use the ShinyRed WPF style?

Tags:

wpf

xaml

themes

This is my first serious WPF application. So far there's nothing but a label on the main form.

I got the ShinyRed.xaml theme from here. I followed the instructions on the site (and on several other sites) but could not get the theme to apply to the Label control.

How do I get this style to work? Am I right in my understanding - that I can point to this style xaml and it will automatically be applied as the default style for all controls?

like image 527
William Mioch Avatar asked Nov 05 '22 22:11

William Mioch


1 Answers

Styles are always applied by default if they are specified as a resource using a TargetType. If they are placed in the Application.Resources however they will apply even inside Templates which is not the case otherwise. To use a theme you can just reference it in App.xaml:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Themes/ShinyRed.xaml"/>
        </ResourceDictionary.MergedDictionaries>
        <!-- Other app resources here -->
    </ResourceDictionary>
</Application.Resources>

See the Resouces Overview on MSDN for more info.

like image 146
H.B. Avatar answered Nov 14 '22 04:11

H.B.