PM> Install-Package MahApps.Metro
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
using MahApps.Metro.Controls;
namespace WpfApplication
{
public partial class MainWindow : MetroWindow
{
public MainWindow()
{
InitializeComponent();
}
}
}
可以添加自己的控制 LeftWindowsCommands 或 RightWindowsCommands
...
内添加:
显示图标需要加载MahApps.Metro.Resources资源
PM> Install-Package MahApps.Metro.Resources
You can choose between these available accents:
“Red”, “Green”, “Blue”, “Purple”, “Orange”, “Lime”, “Emerald”, “Teal”, “Cyan”, “Cobalt”, “Indigo”, “Violet”, “Pink”, “Magenta”, “Crimson”, “Amber”, “Yellow”, “Brown”, “Olive”, “Steel”, “Mauve”, “Taupe”, “Sienna”
and these themes:
“BaseLight”, “BaseDark”
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
// get the current app style (theme and accent) from the application
// you can then use the current theme and custom accent instead set a new theme
Tuple appStyle = ThemeManager.DetectAppStyle(Application.Current);
// now set the Green accent and dark theme
ThemeManager.ChangeAppStyle(Application.Current,
ThemeManager.GetAccent("Green"),
ThemeManager.GetAppTheme("BaseDark")); // or appStyle.Item1
base.OnStartup(e);
}
}
public partial class AccentStyleWindow : MetroWindow
{
public void ChangeAppStyle()
{
// set the Red accent and dark theme only to the current window
ThemeManager.ChangeAppStyle(this,
ThemeManager.GetAccent("Red"),
ThemeManager.GetAppTheme("BaseDark"));
}
}
还可以自定义主题
参考: