文章目录

前言一、MahApps.Metro基于WPF的UI控件库1.安装包2.添加资源3.主视图改造4.视图的数据源5.运行程序

前言

MahApps.Metro是一个用于开发Windows应用程序的开源.NET库,它可以提供一种简单的方式来为WPF应用程序添加丰富的用户界面元素。

MahApps.Metro官方文档:https://mahapps.com/docs/

MahApps.Metro源码网址:https://github.com/MahApps/MahApps.Metro

一、MahApps.Metro基于WPF的UI控件库

1.安装包

MahApps.Metro

2.添加资源

在app.xaml中添加资源

3.主视图改造

主视图的cs文件需要继承MetroWindow

public partial class StartView : MetroWindow

{

public StartView()

{

InitializeComponent();

}

}

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"

xmlns:cal="http://www.caliburnproject.org"

xmlns:local="clr-namespace:WpfApp8"

mc:Ignorable="d"

GlowBrush="{DynamicResource MahApps.Brushes.Accent}"

ResizeMode="CanResizeWithGrip"

Title="StartView" Height="300" Width="600" WindowStartupLocation="CenterScreen">