Skip to content

Commit

Permalink
introduce MetroWindowButtonSytle
Browse files Browse the repository at this point in the history
IronicallyNamedChromelessButtonStyle is obsolete in next release
  • Loading branch information
punker76 committed Mar 6, 2014
1 parent 6baa3b1 commit 933faac
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 23 deletions.
24 changes: 23 additions & 1 deletion MahApps.Metro/Styles/Controls.Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
Value="{StaticResource ChromelessButtonTemplate}" />
</Style>

<Style x:Key="IronicallyNamedChromelessButtonStyle"
<!-- base button style for min, max and close window buttons -->
<Style x:Key="MetroBaseWindowButtonSytle"

This comment has been minimized.

Copy link
@Sorien

Sorien Mar 7, 2014

typo Sytle -> style

TargetType="{x:Type Button}">
<Setter Property="Background"
Value="{DynamicResource TransparentWhiteBrush}" />
Expand Down Expand Up @@ -212,6 +213,27 @@
</Setter>
</Style>

<!-- default button style for min, max and close window buttons -->
<Style x:Key="MetroWindowButtonSytle"
TargetType="{x:Type Button}"
BasedOn="{StaticResource MetroBaseWindowButtonSytle}">
<Setter Property="FocusVisualStyle"
Value="{x:Null}" />
<Setter Property="IsTabStop"
Value="False" />
<Setter Property="Width"
Value="34" />
<Setter Property="MaxHeight"
Value="34" />
<Setter Property="Padding"
Value="0" />
</Style>

<!-- obsolete, will be deleted in 0.14 -->
<Style x:Key="IronicallyNamedChromelessButtonStyle"
TargetType="{x:Type Button}"
BasedOn="{StaticResource MetroBaseWindowButtonSytle}"/>

<!-- style for default button -->
<Style TargetType="{x:Type Button}"
x:Key="MetroButton">
Expand Down
31 changes: 9 additions & 22 deletions MahApps.Metro/Themes/MetroWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
RecognizesAccessKey="True"
Opacity=".5"
Margin="9,1,9,1" />

<Rectangle x:Name="border"
SnapsToDevicePixels="True"
IsHitTestVisible="False"
Expand Down Expand Up @@ -482,13 +482,9 @@
<StackPanel Orientation="Horizontal">

<Button x:Name="PART_Min"
FocusVisualStyle="{x:Null}"
IsTabStop="False"
Width="34"
Height="{Binding TitlebarHeight, RelativeSource={RelativeSource AncestorType=Controls:MetroWindow}}"
MaxHeight="34"
Style="{DynamicResource IronicallyNamedChromelessButtonStyle}"
Padding="0"
Style="{DynamicResource MetroWindowButtonSytle}"
Foreground="{TemplateBinding Foreground}"
ToolTip="{Binding Minimize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:WindowButtonCommands}}}"
Visibility="{Binding ShowMinButton, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}, Converter={StaticResource BooleanToVisibilityConverter}}">
<Path Data="F1M0,6L0,9 9,9 9,6 0,6z"
Expand All @@ -497,16 +493,11 @@
</Button>

<Button x:Name="PART_Max"
FocusVisualStyle="{x:Null}"
IsTabStop="False"
Width="34"
Height="{Binding TitlebarHeight, RelativeSource={RelativeSource AncestorType=Controls:MetroWindow}}"
MaxHeight="34"
Style="{DynamicResource IronicallyNamedChromelessButtonStyle}"
Padding="0"
Style="{DynamicResource MetroWindowButtonSytle}"
Foreground="{TemplateBinding Foreground}"
Visibility="{Binding ShowMaxRestoreButton, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}, Converter={StaticResource BooleanToVisibilityConverter}}"
ToolTip="{Binding Maximize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:WindowButtonCommands}}}">
ToolTip="{Binding Maximize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:WindowButtonCommands}}}"
Visibility="{Binding ShowMaxRestoreButton, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid>
<Path x:Name="MaximisePath"
SnapsToDevicePixels="True"
Expand All @@ -520,15 +511,11 @@
</Button>

<Button x:Name="PART_Close"
FocusVisualStyle="{x:Null}"
IsTabStop="False"
Width="34"
Height="{Binding TitlebarHeight, RelativeSource={RelativeSource AncestorType=Controls:MetroWindow}}"
MaxHeight="34"
Style="{DynamicResource IronicallyNamedChromelessButtonStyle}"
Style="{DynamicResource MetroWindowButtonSytle}"
Foreground="{TemplateBinding Foreground}"
ToolTip="{Binding Close, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:WindowButtonCommands}}}"
Visibility="{Binding ShowCloseButton, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}, Converter={StaticResource BooleanToVisibilityConverter}}"
Foreground="{TemplateBinding Foreground}">
Visibility="{Binding ShowCloseButton, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}, Converter={StaticResource BooleanToVisibilityConverter}}">
<Path Data="F1M0,0L2,0 5,3 8,0 10,0 6,4 10,8 8,8 5,5 2,8 0,8 4,4 0,0z"
SnapsToDevicePixels="True"
Fill="{TemplateBinding Foreground}" />
Expand Down

0 comments on commit 933faac

Please sign in to comment.