Guide · Open source
How to use MaterialDesignInXamlToolkit in a WPF app
Updated · written with AI from the project's own documentation and checked against our catalogue data
MaterialDesignInXamlToolkit is a free, MIT-licensed theme and control library that gives Windows desktop apps built with WPF the look of Google's Material Design. It adds styled controls such as buttons, cards and dialogs, an icon pack, and a way to change the color palette. This guide walks through installing it into an existing WPF project and applying the basic setup, so you can start using it in Visual Studio 2022.
Quick start
- 1Check prerequisites. Confirm you have an existing WPF project open in Microsoft Visual Studio 2022 with the .NET desktop development workload installed.
- 2Install the package. Run Install-Package MaterialDesignThemes in the Package Manager Console, or install MaterialDesignThemes from the NuGet package manager.
- 3Edit App.xaml. Add the materialDesign namespace and merge a BundledTheme with your base theme and colors.
- 4Reference the defaults file. Add the MaterialDesign2.Defaults.xaml resource, or MaterialDesign3.Defaults.xaml if you target Material Design 3.
- 5Style the main window. Set Style to MaterialDesignWindow on the Window element in MainWindow.xaml.
- 6Run and adjust. Build and run the app, then change the palette colors in the BundledTheme to see the effect.
What you need before you start
The toolkit targets Windows desktop applications built with WPF, so you need an existing WPF project. The README assumes you are using Microsoft Visual Studio 2022 with the .NET desktop development workload.
- Microsoft Visual Studio 2022
- .NET desktop development workload
- An existing WPF project
Install MaterialDesignThemes with NuGet
You can install the toolkit through the visual NuGet package manager in Visual Studio, or run the command below in the Package Manager Console. The package is named MaterialDesignThemes.
Install-Package MaterialDesignThemesAdd the theme to App.xaml
Open App.xaml and add the materialDesign XML namespace to the Application element. Then merge a BundledTheme into the resource dictionaries and reference the MaterialDesign2 defaults file. The BundledTheme sets the base theme and the primary and secondary colors. The sample below uses Light, DeepPurple and Lime, which you can change.
- To target Material Design 3, change the ResourceDictionary line to use MaterialDesign3.Defaults.xaml instead.
<Application
x:Class="Example.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="Lime" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign2.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>Apply the Material Design window style
In MainWindow.xaml, add the MaterialDesignWindow style to the Window element. This applies the toolkit's window styling to your main window.
<Window [...]
Style="{StaticResource MaterialDesignWindow}"
[...] >Understand the XML namespaces
The toolkit exposes two namespaces. The materialDesign prefix is the primary namespace for public types, controls and converters. The materialDesignInternal prefix covers internal implementation types, which the README says are not guaranteed to stay compatible between versions. Avoid depending on them unless you accept that risk.
- materialDesign: http://materialdesigninxaml.net/winfx/xaml/themes
- materialDesignInternal: http://materialdesigninxaml.net/winfx/xaml/themes-internal
Explore the demo apps
The repository includes demo applications you can open and run. The README recommends MaterialDesignDemo as a reference app that contains all controls and is a good tool when developing apps with the library. Use it to see how each control is styled before you write your own XAML.
- MaterialDesignDemo: Material Design 2 reference app with all controls
- MaterialDesign3Demo: Material Design 3 reference app, marked as under development
- MahAppsDragablzDemo: demo combining Dragablz and MahApps
What people use it for
- Give a WPF line-of-business app a modern Material Design look without writing styles from scratch
- Use themed cards and dialogs in a Windows desktop tool
- Combine the toolkit with Dragablz tab layouts or MahApps.Metro windows, which the README lists as compatible
- Offer light and dark or different color palettes in a desktop app
Frequently asked questions
Is MaterialDesignInXamlToolkit free to use?
The project is licensed under the MIT license, as stated in the repository summary. Check the license file in the repository for the full terms before you ship a product.
How do I install MaterialDesignInXamlToolkit?
Install the MaterialDesignThemes NuGet package. You can use the visual NuGet package manager in Visual Studio or run Install-Package MaterialDesignThemes in the Package Manager Console.
What are the requirements for MaterialDesignInXamlToolkit?
The README says you need an existing WPF project and Microsoft Visual Studio 2022 with the .NET desktop development workload. The toolkit only targets Windows desktop WPF, not web or mobile.
Can I use MaterialDesignInXamlToolkit with Dragablz or MahApps?
Yes. The README lists both Dragablz and MahApps as compatible, and the repository includes a MahAppsDragablzDemo app that combines them.
Does MaterialDesignInXamlToolkit support Material Design 3?
Yes. Change the ResourceDictionary line in App.xaml to reference MaterialDesign3.Defaults.xaml. The README notes the MaterialDesign3 demo is still under development.
What are the alternatives to MaterialDesignInXamlToolkit?
Projects comparable in purpose include MahApps.Metro, Dragablz and WPF UI. MahApps.Metro and Dragablz are also compatible with this toolkit, so you can use them together rather than choosing one.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Choose MaterialDesignInXamlToolkit if you build Windows desktop apps with WPF and want a Material Design look without writing your own styles. Pick something else if you build for web or mobile, need to stay on older Visual Studio versions, or depend on the internal namespace staying stable between releases.
Install options & downloads