Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the original Win 10 close button style #3133

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -73,7 +73,7 @@ protected override void OnRender(DrawingContext dc)
break;
case MultiFrameImageMode.NoScaleSmallerFrame:
var maxSize = Math.Min(RenderSize.Width, RenderSize.Height);
var maxFrame = _frames.LastOrDefault(f => f.Width <= maxSize && f.Height >= maxSize) ?? _frames.First();
var maxFrame = _frames.LastOrDefault(f => f.Width <= maxSize && f.Height <= maxSize) ?? _frames.First();
dc.DrawImage(maxFrame, new Rect((RenderSize.Width-maxFrame.Width)/2, (RenderSize.Height - maxFrame.Height) / 2, maxFrame.Width, maxFrame.Height));
break;
default:
Expand Down
46 changes: 46 additions & 0 deletions src/MahApps.Metro/MahApps.Metro/Styles/Controls.Buttons.xaml
Expand Up @@ -419,6 +419,18 @@
<Setter Property="MaxHeight" Value="34" />
<Setter Property="Padding" Value="0" />
<Setter Property="Width" Value="34" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource SemiTransparentWhiteBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource IdealForegroundDisabledBrush}" />
</Trigger>
</Style.Triggers>
</Style>

<!-- dark button style for min, max and close window buttons -->
Expand All @@ -439,6 +451,40 @@
</Style.Triggers>
</Style>

<Style x:Key="MahApps.Metro.Styles.WindowButton.Close.Light.Win10"
BasedOn="{StaticResource LightMetroWindowButtonStyle}"
TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E81123" />
</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 IdealForegroundDisabledBrush}" />
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="MahApps.Metro.Styles.WindowButton.Close.Dark.Win10"
BasedOn="{StaticResource DarkMetroWindowButtonStyle}"
TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E81123" />
</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 DarkIdealForegroundDisabledBrush}" />
</Trigger>
</Style.Triggers>
</Style>

<!-- style for default button -->
<Style x:Key="MahApps.Metro.Styles.MetroButton" TargetType="{x:Type ButtonBase}">
<Setter Property="Background" Value="{DynamicResource GrayBrush10}" />
Expand Down
Expand Up @@ -211,6 +211,8 @@
<Style x:Key="MahApps.Metro.Styles.WindowButtonCommands.Win10"
BasedOn="{StaticResource MahApps.Metro.Styles.WindowButtonCommands}"
TargetType="{x:Type Controls:WindowButtonCommands}">
<Setter Property="DarkCloseButtonStyle" Value="{DynamicResource MahApps.Metro.Styles.WindowButton.Close.Dark.Win10}" />
<Setter Property="LightCloseButtonStyle" Value="{DynamicResource MahApps.Metro.Styles.WindowButton.Close.Light.Win10}" />
<Setter Property="Template" Value="{StaticResource MahApps.Metro.Templates.WindowButtonCommands.Win10}" />
</Style>

Expand Down