mui icon indicating copy to clipboard operation
mui copied to clipboard

Set dark theme as default theme

Open IsaacHub opened this issue 8 years ago • 1 comments

Could someone tell me how to change the default theme to dark? Right now by default the theme is light,

IsaacHub avatar Feb 08 '17 10:02 IsaacHub

Hi folk,

First I change this code at MainWindow():

public MainWindow() { FirstFloor.ModernUI.Presentation.AppearanceManager.Current.ThemeSource = new Uri("pack://application:,,,/FirstFloor.ModernUI;component/Assets/ModernUI.Dark.xaml");

InitializeComponent();

}

Then I changed this code to sync Settings with Dark value in AppearanceViewModel:

public Link SelectedTheme { get { return this.selectedTheme; } set { if (this.selectedTheme == null && value == null) { if (AppearanceManager.Current.ThemeSource.LocalPath.IndexOf("Dark") > -1) this.selectedTheme = this.themes[0]; else this.selectedTheme = this.themes[1];

        OnPropertyChanged("SelectedTheme");
    }
    else if (this.selectedTheme != value)
    {
        this.selectedTheme = value;
        OnPropertyChanged("SelectedTheme");

        // and update the actual theme
        AppearanceManager.Current.ThemeSource = value.Source;
    }
}

}

Good luck

JosepBalague avatar Mar 11 '17 21:03 JosepBalague