Skip to content

Commit

Permalink
Improving native ContextMenu in demo
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed May 11, 2024
1 parent 80d9415 commit e55e474
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/MahApps.Metro.Samples/MahApps.Metro.Demo/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System.Windows;
using ControlzEx.Theming;

namespace MetroDemo
{
Expand All @@ -11,5 +12,28 @@ namespace MetroDemo
/// </summary>
public partial class App : Application
{
/// <inheritdoc />
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
}
}
}
}

0 comments on commit e55e474

Please sign in to comment.