第一步:引入Fluent Ribbon的庫 git
第一種方法:直接到github上下載, github
下載地址:https://github.com/fluentribbon/Fluent.Ribbon express
第二種方法:在VS項目引用處,點擊右鍵,彈出Nuget管理程序包,輸入Fluent.Ribbon查詢,安裝對應的包文件 app
第二步:設置默認皮膚 spa
打開App.xaml文件,寫入以下配置,當前最新版本只定義了這個默認皮膚 orm
<Application.Resources> xml
<ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Generic.xaml" /> blog
</Application.Resources> get
第三步 設置窗體爲RibbonWindow it
以下圖,窗體爲RibbonWindow類型,而且引入Fluent的命名空間:xmlns:Fluent="urn:fluent-ribbon"
第四步,建立Ribbon控件
代碼以下所示:
<Fluent:RibbonWindow x:Class="DesignLGK.MainWindow" 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/markupcompatibility/2006" xmlns:local="clr-namespace:DesignLGK" xmlns:Fluent="urn:fluent-ribbon" mc:Ignorable="d" Title="" Height="600" Width="800" WindowState="Maximized"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Fluent:Ribbon Grid.Row="0"> <Fluent:RibbonTabItem Header="項目" IsSelected="True"></Fluent:RibbonTabItem> </Fluent:Ribbon> </Grid> </Fluent:RibbonWindow> |
完成之後,其界面以下: