【问题标题】:How to change statusbar color in Fluent Ribbon如何在 Fluent Ribbon 中更改状态栏颜色
【发布时间】:2017-02-10 09:37:10
【问题描述】:

我将 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>

【问题讨论】:

  • 我从您的问题标题中删除了标签。请参阅here 为什么。

标签: c# wpf statusbar fluent-ribbon


【解决方案1】:

FluentRibbon 中的StatusBar 忽略了Background 属性,因为 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>

【讨论】:

  • 我将您的代码复制到了我的应用程序中。它对我不起作用。还是蓝色的
  • @Tata​​rinho,您使用的是哪个版本的Fluent.Ribbon?哪个主题?
  • 我认为是3.0.3.0版本。
  • @Tata​​rinho,好吧,这可能是问题所在。我的示例适用于 v4.x。
  • 在哪里可以找到更新的版本?我在codeplex平台上发现只有3.0.3
猜你喜欢
  • 2011-03-18
  • 2021-11-05
  • 1970-01-01
  • 2023-03-05
  • 1970-01-01
  • 1970-01-01
  • 2016-09-08
相关资源
最近更新 更多