Browse Source

fix backdrop not setting properly on launch & limited backdrop options

pull/5/head
JT 1 year ago
parent
commit
8142526817
  1. 14
      StabilityMatrix/ViewModels/MainWindowViewModel.cs
  2. 2
      StabilityMatrix/ViewModels/SettingsViewModel.cs

14
StabilityMatrix/ViewModels/MainWindowViewModel.cs

@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using System.Windows.Shell;
using CommunityToolkit.Mvvm.ComponentModel;
@ -88,15 +89,24 @@ public partial class MainWindowViewModel : ObservableObject
private void SetTheme()
{
Application.Current.Dispatcher.BeginInvoke(() =>
{
if (Application.Current.MainWindow != null)
{
WindowBackdrop.ApplyBackdrop(Application.Current.MainWindow,
settingsManager.Settings.WindowBackdropType);
}
var theme = settingsManager.Settings.Theme;
switch (theme)
{
case "Dark":
Theme.Apply(ThemeType.Dark, WindowBackdropType.Acrylic);
Theme.Apply(ThemeType.Dark, settingsManager.Settings.WindowBackdropType);
break;
case "Light":
Theme.Apply(ThemeType.Light, WindowBackdropType.Acrylic);
Theme.Apply(ThemeType.Light, settingsManager.Settings.WindowBackdropType);
break;
}
});
}
}

2
StabilityMatrix/ViewModels/SettingsViewModel.cs

@ -34,9 +34,7 @@ public partial class SettingsViewModel : ObservableObject
public ObservableCollection<WindowBackdropType> AvailableBackdrops => new()
{
WindowBackdropType.Acrylic,
WindowBackdropType.Auto,
WindowBackdropType.Mica,
WindowBackdropType.None,
WindowBackdropType.Tabbed
};
private readonly IContentDialogService contentDialogService;

Loading…
Cancel
Save