Skip to content

Commit b98f96a

Browse files
committed
Merge pull request #2174 from thoemmi/dynamic-statusbar-background-2173
Dynamic statusbar background
2 parents 4852189 + 2da98e3 commit b98f96a

File tree

7 files changed

+48
-2
lines changed

7 files changed

+48
-2
lines changed

MahApps.Metro/MahApps.Metro.NET45.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@
376376
<Generator>MSBuild:Compile</Generator>
377377
<SubType>Designer</SubType>
378378
</Page>
379+
<Page Include="Styles\Clean\CleanStatusBar.xaml">
380+
<Generator>MSBuild:Compile</Generator>
381+
<SubType>Designer</SubType>
382+
</Page>
379383
<Page Include="Styles\Clean\CleanWindow.xaml">
380384
<SubType>Designer</SubType>
381385
<Generator>MSBuild:Compile</Generator>

MahApps.Metro/MahApps.Metro.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@
317317
<SubType>Designer</SubType>
318318
<Generator>MSBuild:Compile</Generator>
319319
</Page>
320+
<Page Include="Styles\Clean\CleanStatusBar.xaml">
321+
<SubType>Designer</SubType>
322+
<Generator>MSBuild:Compile</Generator>
323+
</Page>
320324
<Page Include="Styles\Clean\CleanWindow.xaml">
321325
<SubType>Designer</SubType>
322326
<Generator>MSBuild:Compile</Generator>

MahApps.Metro/Styles/Clean/Clean.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Clean/CleanWindow.xaml" />
88
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Clean/CleanWindowButtonCommands.xaml" />
99
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Clean/CleanWindowCommands.xaml" />
10+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Clean/CleanStatusBar.xaml" />
1011
</ResourceDictionary.MergedDictionaries>
1112

1213
<Style TargetType="{x:Type GroupBox}" BasedOn="{StaticResource CleanGroupBoxStyleKey}" />
1314
<Style TargetType="{x:Type Controls:MetroWindow}" BasedOn="{StaticResource CleanWindowStyleKey}" />
1415
<Style TargetType="{x:Type Controls:WindowButtonCommands}" BasedOn="{StaticResource CleanWindowButtonCommandsStyleKey}" />
1516
<Style TargetType="{x:Type Controls:WindowCommands}" BasedOn="{StaticResource CleanWindowCommandsStyleKey}" />
17+
<Style TargetType="{x:Type StatusBar}" BasedOn="{StaticResource CleanMetroStatusBarKey}" />
1618

1719
</ResourceDictionary>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
3+
4+
<ResourceDictionary.MergedDictionaries>
5+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.StatusBar.xaml" />
6+
</ResourceDictionary.MergedDictionaries>
7+
8+
<Style x:Key="CleanMetroStatusBarKey"
9+
BasedOn="{StaticResource MetroStatusBar}"
10+
TargetType="{x:Type StatusBar}">
11+
<Setter Property="Foreground"
12+
Value="{DynamicResource BlackBrush}" />
13+
</Style>
14+
15+
<Style x:Key="CleanMetroStatusBarSeparator"
16+
BasedOn="{StaticResource MetroStatusBarSeparator}"
17+
TargetType="{x:Type Separator}">
18+
<Setter Property="Background"
19+
Value="{DynamicResource BlackBrush}" />
20+
</Style>
21+
22+
</ResourceDictionary>

MahApps.Metro/Styles/Controls.StatusBar.xaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:Controls="clr-namespace:MahApps.Metro.Controls">
34

45
<Style x:Key="MetroStatusBarItem"
56
TargetType="{x:Type StatusBarItem}">
@@ -58,7 +59,7 @@
5859
<Style x:Key="MetroStatusBar"
5960
TargetType="{x:Type StatusBar}">
6061
<Setter Property="Background"
61-
Value="{DynamicResource AccentColorBrush}" />
62+
Value="{Binding Path=WindowTitleBrush, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}" />
6263
<Setter Property="Foreground"
6364
Value="{DynamicResource IdealForegroundColorBrush}" />
6465
<Setter Property="FontFamily"
@@ -87,6 +88,11 @@
8788
Property="BorderBrush"
8889
Value="{DynamicResource GrayBrush9}" />
8990
</Trigger>
91+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=IsActive}"
92+
Value="False">
93+
<Setter Property="Background"
94+
Value="{Binding Path=NonActiveWindowTitleBrush, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}" />
95+
</DataTrigger>
9096
</ControlTemplate.Triggers>
9197
</ControlTemplate>
9298
</Setter.Value>

docs/release-notes/1.2.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ This is a bug fix and feature release of MahApps.Metro v1.2.0.
8686
+ Mark ButtonHelper `PreserveTextCase` attached property as obsolete
8787
+ Use `ContentCharacterCasing` for `MetroDataGridColumnHeader` and `MetroGridViewColumnHeader` too
8888
- Dynamic theme for window commands #2152 (@crumbl3d)
89+
- `StatusBar`'s background color now matches the title bar #2173 #2174 (@thoemmi)
8990

9091
# Bugfixes
9192

samples/MetroDemo/ExampleWindows/CleanWindowDemo.xaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
<Grid.RowDefinitions>
105105
<RowDefinition Height="40" />
106106
<RowDefinition Height="*" />
107+
<RowDefinition Height="Auto" />
107108
</Grid.RowDefinitions>
108109

109110
<Grid Grid.Row="0">
@@ -157,6 +158,12 @@
157158
</StackPanel>
158159
</GroupBox>
159160
</Grid>
161+
162+
<StatusBar Grid.Row="2">
163+
<StatusBarItem>MahApps.Metro Clean Window</StatusBarItem>
164+
<Separator Style="{StaticResource CleanMetroStatusBarSeparator}" />
165+
<StatusBarItem>Some stuff</StatusBarItem>
166+
</StatusBar>
160167
</Grid>
161168

162169
</Controls:MetroWindow>

0 commit comments

Comments
 (0)