2017-02-10 89 views
1

我對我的WPF應用程序使用Fluent功能區,並且用簡單的東西來填充。我無法更改StatusBar的顏色(來自FluentRibbon或默認的)。 我的狀態欄仍然是藍色。我該如何改變它?背景屬性不適用於我。如何更改Fluent功能區中的狀態欄顏色

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

+1

我刪除標記從你的問題的標題。看[這裏](http://stackoverflow.com/help/tagging)爲什麼。 – dymanoid

回答

0

FluentRibbonStatusBar忽略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> 
+0

我將你的代碼複製到我的應用程序中。它不適合我。它仍然是藍色 – Tatarinho

+0

@Tata​​rinho,您使用的是哪種版本的「Fluent.Ribbon」?哪個主題? – dymanoid

+0

我認爲它是3.0.3.0版本。 – Tatarinho