Skip to content

Commit

Permalink
(MahAppsGH-3623) Win10 styles for CleanWindow WindowButtonCommands
Browse files Browse the repository at this point in the history
- Add new style `MahApps.Styles.Button.CleanWindow.Close.Light.Win10`
- Add new style `MahApps.Styles.Button.CleanWindow.Close.Dark.Win10`
- Add new style `MahApps.Styles.WindowButtonCommands.Clean.Win10`
  • Loading branch information
punker76 authored and amkuchta committed Nov 19, 2019
1 parent 107267c commit 9409744
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 13 deletions.
Expand Up @@ -52,6 +52,10 @@
</Controls:WindowCommands>
</Controls:MetroWindow.RightWindowCommands>

<Controls:MetroWindow.WindowButtonCommands>
<Controls:WindowButtonCommands Style="{DynamicResource MahApps.Styles.WindowButtonCommands.Clean.Win10}" />
</Controls:MetroWindow.WindowButtonCommands>

<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl>
<Controls:Flyout x:Name="settingsFlyout"
Expand Down
8 changes: 8 additions & 0 deletions src/MahApps.Metro/Styles/Clean/CleanWindowButtonCommands.xaml
Expand Up @@ -18,4 +18,12 @@
<Setter Property="LightMinButtonStyle" Value="{DynamicResource MahApps.Styles.Button.CleanWindow.Light}" />
</Style>

<Style x:Key="MahApps.Styles.WindowButtonCommands.Clean.Win10"
BasedOn="{StaticResource MahApps.Styles.WindowButtonCommands.Clean}"
TargetType="{x:Type Controls:WindowButtonCommands}">
<Setter Property="DarkCloseButtonStyle" Value="{DynamicResource MahApps.Styles.Button.CleanWindow.Close.Dark.Win10}" />
<Setter Property="LightCloseButtonStyle" Value="{DynamicResource MahApps.Styles.Button.CleanWindow.Close.Light.Win10}" />
<Setter Property="Template" Value="{StaticResource MahApps.Templates.WindowButtonCommands.Win10}" />
</Style>

</ResourceDictionary>
30 changes: 30 additions & 0 deletions src/MahApps.Metro/Styles/Clean/CleanWindowButtons.xaml
Expand Up @@ -71,4 +71,34 @@
</Style.Triggers>
</Style>

<Style x:Key="MahApps.Styles.Button.CleanWindow.Close.Light.Win10"
BasedOn="{StaticResource MahApps.Styles.Button.CleanWindow.Light}"
TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E81123" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#F1707A" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="MahApps.Styles.Button.CleanWindow.Close.Dark.Win10"
BasedOn="{StaticResource MahApps.Styles.Button.CleanWindow.Dark}"
TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E81123" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#F1707A" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>

</ResourceDictionary>
16 changes: 4 additions & 12 deletions src/MahApps.Metro/Styles/Controls.Buttons.xaml
Expand Up @@ -273,6 +273,7 @@
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.TransparentWhite}" />
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Opacity" Value="0.7" />
<Setter Property="Padding" Value="1" />
<Setter Property="Template">
<Setter.Value>
Expand All @@ -287,22 +288,17 @@
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
Opacity="0.6"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PART_ContentPresenter" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.SemiTransparentWhite}" />
<Setter Property="Opacity" Value="1" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.AccentBase}" />
Expand Down Expand Up @@ -362,14 +358,12 @@
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E81123" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#F1707A" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.IdealForegroundDisabled}" />
</Trigger>
</Style.Triggers>
</Style>

Expand All @@ -379,14 +373,12 @@
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E81123" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#F1707A" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.DarkIdealForegroundDisabled}" />
</Trigger>
</Style.Triggers>
</Style>

Expand Down
4 changes: 3 additions & 1 deletion src/MahApps.Metro/Themes/WindowButtonCommands.xaml
Expand Up @@ -190,7 +190,9 @@
RelativeSource="{RelativeSource AncestorType={x:Type Controls:MetroWindow}}" />
</MultiBinding>
</Button.Visibility>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid HorizontalAlignment="Center"
VerticalAlignment="Center"
UseLayoutRounding="False">
<Line SnapsToDevicePixels="True"
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
X1="0"
Expand Down

0 comments on commit 9409744

Please sign in to comment.