WPF/MVVM学习笔记(3)

如何使用MahApps.Metro?

参考:https://www.cnblogs.com/yhcao/p/6237611.html

1 下载mahapps.metro到项目中

使用nuget控制台安装

PM> Install-Package MahApps.Metro

2 在view.xaml文件中引入命名空间

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

3 将view.xmal原来的标签替换为


4 打开view.xaml.cs文件,将继承类由window改为metrowindow,同时添加对应的命名空间

using MahApps.Metro.Controls;
using System.Windows;

namespace TestCaseGen
{
    /// 
    /// Description for MvvmView.
    /// 
    public partial class MvvmView : MetroWindow
    {
        /// 
        /// Initializes a new instance of the MvvmView class.
        /// 
        public MvvmView()
        {
            InitializeComponent();
        }
    }
}

5 添加样式,在app.xaml文件下


        
        
            
            
                
                
                
                
                
                
                
            
        
    

note:主题可改为“BaseLight”, “BaseDark”,颜色相关科改为“Red”, “Green”, “Blue”, “Purple”, “Orange”, “Lime”, “Emerald”, “Teal”, “Cyan”, “Cobalt”, “Indigo”, “Violet”, “Pink”, “Magenta”, “Crimson”, “Amber”, “Yellow”, “Brown”, “Olive”, “Steel”, “Mauve”, “Taupe”, “Sienna”

 

你可能感兴趣的:(c#,wpf)