1

我将 Fluent Ribbon 用于我的 WPF 应用程序,并且我坚持使用简单的东西。我无法更改 StatusBar 的颜色(来自 FluentRibbon 或默认颜色)。我的状态栏仍然是蓝色的。我怎样才能改变它?背景属性对我不起作用。

我的 XAML 文件看起来像这样(我删除了所有不需要的代码)

<Fluent:RibbonWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent" x:Class="MainWindow"
    Title="App" Height="600" Width="960" Closing="Window_Closing" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="SingleBorderWindow" BorderBrush="WhiteSmoke">
<Grid Name="grid" Focusable="True">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="50*"/>
        <ColumnDefinition Width="61*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="250*" />
        <RowDefinition Height="22"/>
    </Grid.RowDefinitions>
    <Grid.Resources>
        <Style TargetType="{x:Type Fluent:Ribbon}">
            <Setter Property="Margin" Value="0,0,0,0" />
        </Style>
    </Grid.Resources>
    <Fluent:StatusBar Foreground="White" Background="Red">


    </Fluent:StatusBar>
</Grid>

4

1 回答 1

0

StatusBar中的忽略FluentRibbonBackground属性,因为 id 定义了自己的模板,该模板不继承此值而是使用主题颜色。

如果要更改状态栏的背景颜色,则必须覆盖DynamicResource用作背景画笔的画笔。

这是一个例子:

<Fluent:StatusBar>
    <Fluent:StatusBar.Resources>
        <LinearGradientBrush x:Key="StatusBarInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Red" Offset="0" />
            <GradientStop Color="#FFB5C5D9" Offset="1" />
        </LinearGradientBrush>
    </Fluent:StatusBar.Resources>
</Fluent:StatusBar>
于 2017-02-10T09:57:12.933 回答