Skip to content

Commit

Permalink
Fix #229: Close/Maximize/Minimize button's name is lost in window if …
Browse files Browse the repository at this point in the history
…added ui:WindowHelper.UseModernWindowStyle="True"
  • Loading branch information
Kinnara committed Jan 4, 2021
1 parent fe31f53 commit 47b84d5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ModernWpf/TitleBar/TitleBarControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
CommandTarget="{TemplateBinding BackButtonCommandTarget}"
IsActive="{TemplateBinding IsActive}"
Visibility="Collapsed"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
AutomationProperties.Name="Back" />
</StackPanel>

<StackPanel
Expand Down Expand Up @@ -97,7 +98,8 @@
ContentTemplate="{StaticResource IconTemplate}"
IsActive="{TemplateBinding IsActive}"
Style="{TemplateBinding ButtonStyle}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
AutomationProperties.Name="Minimize" />

<primitives:TitleBarButton
x:Name="MaximizeRestoreButton"
Expand All @@ -106,7 +108,8 @@
ContentTemplate="{StaticResource IconTemplate}"
IsActive="{TemplateBinding IsActive}"
Style="{TemplateBinding ButtonStyle}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
AutomationProperties.Name="Maximize" />

<primitives:TitleBarButton
x:Name="CloseButton"
Expand All @@ -119,7 +122,8 @@
HoverForeground="{DynamicResource SystemControlBackgroundChromeWhiteBrush}"
PressedBackground="#F1707A"
PressedForeground="{DynamicResource SystemControlBackgroundChromeWhiteBrush}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
AutomationProperties.Name="Close" />
</StackPanel>
</Grid>
<ControlTemplate.Triggers>
Expand Down Expand Up @@ -153,6 +157,7 @@
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Value="Maximized">
<Setter TargetName="MaximizeRestoreButton" Property="Content" Value="{StaticResource ChromeRestore}" />
<Setter TargetName="MaximizeRestoreButton" Property="Command" Value="{x:Static SystemCommands.RestoreWindowCommand}" />
<Setter TargetName="MaximizeRestoreButton" Property="AutomationProperties.Name" Value="Restore" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=(SystemParameters.HighContrast)}" Value="true">
<Setter TargetName="PART_BackButton" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
Expand Down

0 comments on commit 47b84d5

Please sign in to comment.