WPF 皮膚之MathApps.Metro UI庫

來源:互聯網
上載者:User

標籤:皮膚   schema   package   present   aml   using   國外   title   init   

在WPF中要想使用Metro風格是很簡單的,可以自己畫嘛..

但是為了節省時間,哈,今天給大家推薦一款國外Metro風格的控制項陳列庫。

本文只起到拋磚引玉的作用,有興趣還是推薦大家上官網,Thanks,官網地址 我會在底部發出。

使用步驟

一、使用Nuget包管理,添加引用

Install-Package MahApps.Metro

或者使用介面管理:

二、修改App.xaml檔案,引用資源

<Application x:Class="MetroWPF.App"             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"             StartupUri="MainWindow.xaml">    <Application.Resources>        <ResourceDictionary>            <ResourceDictionary.MergedDictionaries>                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />            </ResourceDictionary.MergedDictionaries>        </ResourceDictionary>    </Application.Resources></Application>

三、修改表單換成Metro風格

在XAML狀體中進行如下 xmlns 引用。

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

然後將Window標籤替換為如下標籤

  1.  <controls:MetroWindow ...

就ok了。

 

四、修改cs檔案繼承MetroWindow類

//引用using MahApps.Metro.Controls; namespace MetroWPF{    /// <summary>    /// MainWindow.xaml 的互動邏輯    /// </summary>    public partial class MainWindow : MetroWindow    {        public MainWindow()        {            InitializeComponent();        }    }}

官網地址:http://mahapps.com/

更多博文:http://www.wxzzz.com/1202.html

WPF 皮膚之MathApps.Metro UI庫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.