Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applying MahApps.Metro Dark theme

I am relatively new to WPF and I am trying to apply Windows Metro Dark theme to my entire application.

I used the following in my Apps.xaml and I can see the Windows Metro Light theme properly.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

Now I want to change the theme to Dark. I understand I can always use,

ThemeManager.ChangeTheme()

But I believe there should be a way to do this with XAML effective to all the windows of the application.

My Question : Can someone point me how to do this without using ThemeManager in source code?

like image 724
Chathuranga Chandrasekara Avatar asked Jan 26 '14 11:01

Chathuranga Chandrasekara


1 Answers

Try to use BaseDark instead of BaseLight. Try to change this line :

<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />

to this :

<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />

That did the trick for me. Screenshot of my application using MahApps BaseDark and BaseLight accents:

BaseDark enter image description hereBaseLight enter image description here

like image 146
har07 Avatar answered Oct 22 '22 12:10

har07