This class provides a modern Fluent-style replacement for the legacy Win32 system menu (right-click on the window title bar). It seamlessly integrates a MenuFlyout into the window, offering a visually consistent and customizable experience that aligns with modern Windows UI principles.
Features:
Replaces the default system menu with a Fluent-style MenuFlyout.
Supports light and dark themes, adapting dynamically to system or app theme changes.
Provides Built-In Commands with CanExecute methods.
Fully customizable with fluent styling and adaptive UI behavior.
Commands
Name
RestoreCommand
MoveCommand
SizeCommand
MinimizeCommand
MaximizeCommand
CloseCommand
Sample Example
1
new ModernSystemMenu(window);
That’s it, now you can right-click on the Windows title bar and enjoy the modern menu.
Advanced Example
You can Extend ModernSystemMenu and create your own MenuFlyout with your own styles and MenuFlyoutItems.
1.Define ModernSystemMenu in your MainWindow.xaml.cs and pass MenuFlyout
1 2 3 4 5 6 7
public ModernSystemMenu modernSystemMenu; publicMainWindow() { InitializeComponent(); ExtendsContentIntoTitleBar = true; modernSystemMenu = new ModernSystemMenu(this, TitlebarMenuFlyout); }
Then, Add a MenuFlyout with a TitlebarMenuFlyout name in your MainWindow.xaml, you can add it in a Grid.Resource for example.
Make sure you are using ExtendsContentIntoTitleBar = true; and DevWinUI.Controls package is installed. For MenuFlyoutItem we use custom style called ModernSystemMenuFlyoutItemStyle which is included in the DevWinUI.Controls package.