使用NuGet安装:Install-Package Fluent.Ribbon
修改App.xaml:
<Application.Resources> <!-- Attach default Theme --> <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Generic.xaml" /> </Application.Resources>
前台代码:
<Fluent:RibbonWindow x:Class="WpfDemo.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/markup-compatibility/2006" xmlns:Fluent="urn:fluent-ribbon" xmlns:local="clr-namespace:WpfDemo" mc:Ignorable="d" Background="Bisque" Title="MainWindow" Height="350" Width="525"> <Grid> <Button Click="Button_Click" /> </Grid> </Fluent:RibbonWindow>
后台代码:
using System.Windows; namespace WpfDemo { /// <summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public partial class MainWindow : Fluent.RibbonWindow { public MainWindow() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { var win = new MainWindow(); win.Owner = this; win.ShowDialog(); } } }
参考资料:http://fluentribbon.github.io/documentation/basic-setup