WPF使用Fluent.Ribbon修改標題欄背景顏色


使用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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM