It's easy to use metro style in WPF, you can draw it yourself.
But in order to save time, ha, today we recommend a foreign Metro style control library.
This article only plays the role, has the interest or the recommendation everybody official Officer Net, Thanks, the website address I will send at the bottom.
Use steps
One, use NuGet package management, add references
Install-package Mahapps.metro
Or use Interface management:
Second, modify the App.xaml file, reference resources
<Applicationx: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> <ResourceDictionarySource= "Pack://application:,,,/mahapps.metro;component/styles/controls.xaml" /> <ResourceDictionarySource= "Pack://application:,,,/mahapps.metro;component/styles/fonts.xaml" /> <ResourceDictionarySource= "Pack://application:,,,/mahapps.metro;component/styles/colors.xaml" /> <ResourceDictionarySource= "Pack://application:,,,/mahapps.metro;component/styles/accents/blue.xaml" /> <ResourceDictionarySource= "Pack://application:,,,/mahapps.metro;component/styles/accents/baselight.xaml" /> </resourcedictionary.mergeddictionaries> </ResourceDictionary> </application.resources></Application>
Third, change the form to Metro style
The following xmlns references are made in a XAML-like body.
- xmlns:controls="Clr-namespace:mahapps.metro.controls;assembly=mahapps.metro"
Then replace the window tag with the following label
- <controls:metrowindow ...
It's OK.
Iv. modification of CS file inheritance Metrowindow class
// References using namespace metrowpf{ //<summary> /// Interactive logic for MainWindow.xaml /// </summary>public Partial class mainwindow:metrowindow { public MainWindow () { InitializeComponent (); }}}
Website address: http://mahapps.com/
More Posts: http://www.wxzzz.com/1202.html
WPF Skin's Mathapps.metro UI Library