From e55e47467341e24193e290afc344b8835f5d519a Mon Sep 17 00:00:00 2001 From: Bastian Schmidt Date: Sat, 11 May 2024 08:05:53 +0200 Subject: [PATCH] Improving native ContextMenu in demo --- .../MahApps.Metro.Demo/App.xaml.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/App.xaml.cs b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/App.xaml.cs index 211f14b3dc..6409d4285c 100644 --- a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/App.xaml.cs +++ b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/App.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Windows; +using ControlzEx.Theming; namespace MetroDemo { @@ -11,5 +12,28 @@ namespace MetroDemo /// public partial class App : Application { + /// + protected override void OnStartup(StartupEventArgs e) + { + ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncWithAppMode; + ThemeManager.Current.SyncTheme(); + + ThemeManager.Current.ThemeChanged += HandleThemeChanged; + +#pragma warning disable CS0618 // Type or member is obsolete + AppModeHelper.SyncAppMode(); +#pragma warning restore CS0618 // Type or member is obsolete + + base.OnStartup(e); + + return; + + void HandleThemeChanged(object? sender, ThemeChangedEventArgs themeChangedEventArgs) + { +#pragma warning disable CS0618 // Type or member is obsolete + AppModeHelper.SyncAppMode(); +#pragma warning restore CS0618 // Type or member is obsolete + } + } } } \ No newline at end of file