user1035681
user1035681

Reputation: 21

MahApps use BaseDark AND BaseLight Theme in one Solution

I have the job to redesign one of our applications. The base mechanism we use, is simple. We got a host application (wpf) with a tab control, the application modules are class libraries with wpf user controls (separate project). the user controls are loaded into the tab control of the host...

Our idea is like that: we would like to style the host with MahApps BaseBlack theme and the modules should be in BaseLight Theme style...

Running this setup causes the modules to be styled with the hosts theme ? What can I do to make the modules running with a separate theme ?

Many thanks - I'm new to wpf and happy to get some help :-)

Peter

Upvotes: 0

Views: 207

Answers (1)

mrsargent
mrsargent

Reputation: 2442

I guess you always have the option of specifying the style local to your MainWindow and to each individual usercontrol instead of just declaring your style for mahapps for your entire application in the app.xaml.

MainWindow

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

Each Usercontrol

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

Upvotes: 1

Related Questions