Windows Presentation Foundation (WPF) remains a powerful UI framework, but let’s face it: its default styling looks outdated for modern standards. Creating a polished, Windows 11-style desktop app often requires substantial time spent building custom themes, controls, and animations from scratch.
This is where MahApps.Metro shines.
MahApps.Metro is an open-source library that transforms standard WPF applications into clean, modern, and stylish interfaces inspired by the Windows Metro/Fluent design language. With minimal setup and well-designed components, it has become one of the most popular UI frameworks for .NET developers.
In this article, we’ll explore what MahApps.Metro offers, why it’s useful, and how to integrate it into your next WPF project.
What Is MahApps.Metro?
MahApps.Metro is a comprehensive UI toolkit for WPF that overrides the default look and feel of your application. It provides:
-
Modern Aesthetics: Metro/Fluent-inspired themes out of the box.
-
Customization: Fully customizable color palettes and accents.
-
Rich Controls: Ready-made components such as dialogs, toggle switches, and tiles.
-
Visual Flair: Animated transitions and ripple effects.
-
Compatibility: Full support for .NET Framework, .NET Core, and .NET 5+.
Unlike building custom UserControls yourself, utilizing this library ensures a consistent design language across your entire application with minimal effort.
Why Use MahApps.Metro?
Modern, Professional Look
WPF’s default controls (like the standard gray button) look like they belong in Windows 98. MahApps.Metro instantly upgrades your application’s appearance to match modern OS standards.
Easy to Customize
Themes, accents, and color palettes can be changed dynamically at runtime. This makes implementation of Dark Mode and Light Mode seamless.
Rich Set of Controls
The library includes polished components that are missing from standard WPF, such as:
-
MetroWindow(Custom chrome window) -
Flyouts
-
Dialogs
-
ToggleSwitch -
RangeSlider -
HamburgerMenu
Active and Mature Project
The library has been around for years and continues to receive updates, community support, and compatibility improvements. [External Link: Visit the official MahApps.Metro GitHub]
Installing MahApps.Metro
You can easily install the library via NuGet Package Manager.
Using Package Manager Console:
Install-Package MahApps.Metro
Using .NET CLI:
dotnet add package MahApps.Metro
Converting Your Window to MetroWindow
To enable the styling, you need to replace the default WPF <Window> with <controls:MetroWindow>.
Before:
<Window x:Class="SampleApp.MainWindow" ...>
After:
-
Add the namespace.
-
Change the root element.
<controls:MetroWindow
x:Class="SampleApp.MainWindow"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="My Modern App" Height="450" Width="800">
<Grid>
</Grid>
</controls:MetroWindow>
Visual Comparison: Below is the difference between a standard WPF window and the modernized look you get immediately after implementing MahApps.Metro.
Applying a Theme and Accent
MahApps.Metro uses a ThemeManager to control global settings. You can set this in your App.xaml.cs or change it dynamically.
Set Dark Theme (Blue Accent):
using ControlzEx.Theming;
// Inside your constructor or event handler
ThemeManager.Current.ChangeTheme(this, "Dark.Blue");
Set Light Theme (Steel Accent):
ThemeManager.Current.ChangeTheme(this, "Light.Steel");
This flexibility is perfect for applications that need to respect user system preferences.
Exploring Key Controls
Flyouts
Flyouts are slide-out panels often used for menus, settings, or notifications. They don't block the UI like modal dialogs.
<controls:MetroWindow.Flyouts>
<controls:FlyoutsControl>
<controls:Flyout Header="Settings" Position="Right" Width="300">
<StackPanel>
<TextBlock Text="Application Settings" Style="{StaticResource MetroTitleTextBlock}"/>
</StackPanel>
</controls:Flyout>
</controls:FlyoutsControl>
</controls:MetroWindow.Flyouts>
Dialogs
Forget the ugly MessageBox.Show(). MahApps provides asynchronous, styled dialogs that overlay the window content nicely.
using MahApps.Metro.Controls.Dialogs;
// Call this from your MetroWindow code-behind or ViewModel
await this.ShowMessageAsync("Success", "This is a modern MahApps dialog!");
Dialog Example: Here is how a clean, dark-themed dialog looks within the application:
ToggleSwitch
A replacement for the CheckBox, offering a modern mobile-style switch.
<controls:ToggleSwitch Header="Enable Dark Mode" IsOn="True"/>
Implementing HamburgerMenu Navigation
One of the standout features is the HamburgerMenu, ideal for modern navigation-based apps (similar to UWP or Windows Settings).
<controls:HamburgerMenu x:Name="HamburgerMenuControl"
HamburgerWidth="48"
ItemsSource="{Binding MenuItems}"
ItemTemplate="{StaticResource MenuItemTemplate}">
<controls:HamburgerMenu.Content>
<Frame x:Name="ContentFrame" NavigationUIVisibility="Hidden"/>
</controls:HamburgerMenu.Content>
</controls:HamburgerMenu>
It gives your app a professional navigation experience with very little configuration.
Best Practices
To get the most out of MahApps.Metro:
-
Consistent Resources: Use the defined
DynamicResourcebrushes (likeMahApps.Brushes.Accent) so your controls update automatically when the theme changes. -
Combine with MVVM: Keep your UI logic separate. MahApps works great with frameworks like Prism or MVVM Community Toolkit.
-
Integration: It works well alongside MaterialDesignInXAML if you want a hybrid look.
Conclusion
MahApps.Metro is one of the most developer-friendly libraries available for WPF. It helps you modernize your application instantly, improve user experience, and reduce UI development time.
Whether you're building a new tool or modernizing a legacy enterprise app, MahApps.Metro is an excellent choice for creating a polished interface with minimal effort.
References
-
Official MahApps.Metro Website & Documentation: https://mahapps.com/
-
MahApps.Metro GitHub Repository: https://github.com/MahApps/MahApps.Metro
-
NuGet Package - MahApps.Metro: https://www.nuget.org/packages/MahApps.Metro/
-
Material Design In XAML Toolkit (Compatible Library): http://materialdesigninxaml.net/
-
Microsoft Learn - WPF Overview: https://learn.microsoft.com/en-us/dotnet/desktop/wpf/overview/
Ready to get started?
Contact IVC for a free consultation and discover how we can help your business grow online.











