Repository navigation
Visual Studio Templates
MahApps.Metro has four templates: three applications to start from, and a window to add to one you have already. They come as a NuGet package that dotnet new installs, which is also where Visual Studio reads them from.
This ships with the next release. The package is not on nuget.org yet.
dotnet new install MahApps.Metro.Templates
dotnet new mahapps -n MyApp
dotnet new mahapps-mvvm -n MyApp
dotnet new mahapps-nav -n MyApp
dotnet new mahapps-window -n SettingsWindow
Every application has a MetroWindow for a window and an App.xaml that already merges what the library needs, so it runs styled from the first build.
mahapps-mvvm adds the MVVM Toolkit and a view model the window is bound to.
mahapps-nav is the one for an application of several pages: a HamburgerMenu down the left side, a Frame beside it that owns its history, and a back arrow in the title bar that walks it. The pane and the frame follow each other, so going back marks the entry of the page that comes up, and a page reached from another page rather than from the pane leaves the pane unmarked.
mahapps-window writes a further window into a project that has one already and takes the namespace from that project, so run it inside the project folder.
| Option | What it does | Default |
|---|---|---|
-f, --framework
|
net10.0-windows, net9.0-windows, net8.0-windows or net462
|
net8.0-windows |
--style |
winui, the look Windows 11 draws, win10, the look UWP gave a control, or metro, the one the library has always drawn |
winui |
--mahapps-version |
the version of MahApps.Metro the project asks for | the version of the template package |
Once the package is installed, the three applications stand in the Create a new project dialog, and Install more templates from the online search there finds the package on nuget.org. Item templates are still missing from the Add New Item dialog, so the window is one for the command line.
Up to 2.4.11 this page offered a Templates.zip to copy into a folder of Visual Studio by hand. It was written in 2014 for .NET 4.5 and MahApps 0.14, and the App.xaml in it merges dictionaries that have not existed since 2.0. It is gone.