Update CaptionButtonForeground resource and WindowDrawnDecorations layout (#779)

* fix: update CaptionButtonForeground resource key and remove cursor setter.

* fix: update WindowDrawnDecorations layout.

* feat: add CaptionButtonDisabledForeground for disabled state and WindowCustomizationsPage.
This commit is contained in:
Zhang Dian
2026-03-26 14:15:47 +08:00
committed by GitHub
parent 0fbcf43309
commit f22709fcb1
7 changed files with 61 additions and 12 deletions

View File

@@ -7,7 +7,6 @@
<Setter Property="Padding" Value="{StaticResource CaptionButtonPadding}" />
<Setter Property="Width" Value="{StaticResource CaptionButtonWidth}" />
<Setter Property="Height" Value="{StaticResource CaptionButtonHeight}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="WindowDecorationProperties.ElementRole" Value="DecorationsElement" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
@@ -39,6 +38,10 @@
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressedBackground}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonDisabledForeground}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type WindowDrawnDecorations}" TargetType="WindowDrawnDecorations">
@@ -50,14 +53,13 @@
<WindowDrawnDecorationsContent>
<WindowDrawnDecorationsContent.Underlay>
<!-- Full-size: covers shadow area + frame + behind client area -->
<Panel>
<Panel Name="PART_UnderlayWrapper">
<Border
Name="PART_WindowBorder"
Margin="{TemplateBinding ShadowThickness}"
Background="{DynamicResource WindowBackground}"
BorderBrush="{DynamicResource WindowBorderBrush}"
BorderThickness="1"
BoxShadow="{DynamicResource WindowBorderShadow}" />
BorderThickness="{TemplateBinding FrameThickness}"
IsHitTestVisible="False" />
<!-- Titlebar: background, title text, and drag area live in underlay -->
<Panel Name="PART_TitleBar"
VerticalAlignment="Top"
@@ -81,7 +83,6 @@
<TextBlock
Margin="12,0,0,0"
VerticalAlignment="Center"
FontSize="12"
Text="{TemplateBinding Title}" />
</Panel>
<StackPanel
@@ -90,9 +91,7 @@
HorizontalAlignment="Right"
VerticalAlignment="Top"
IsVisible="{TemplateBinding HasTitleBar}"
Orientation="Horizontal"
Spacing="2"
TextElement.FontSize="10">
Orientation="Horizontal">
<Button
Name="PART_FullScreenButton"
Theme="{StaticResource CaptionButton}"
@@ -137,7 +136,7 @@
WindowDecorationProperties.ElementRole="CloseButton" />
</StackPanel>
<TextBlock
Margin="12,0"
Margin="12,0,0,0"
VerticalAlignment="Center"
Text="{TemplateBinding Title}" />
</DockPanel>

View File

@@ -7,5 +7,6 @@
<StaticResource x:Key="CaptionButtonCloseForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="CaptionButtonClosePointeroverBackground" ResourceKey="SemiColorDangerPointerover" />
<StaticResource x:Key="CaptionButtonClosePressedBackground" ResourceKey="SemiColorDangerActive" />
<StaticResource x:Key="CaptionButtonForeground" ResourceKey="SemiColorText2" />
<StaticResource x:Key="CaptionButtonForeground" ResourceKey="SemiColorText1" />
<StaticResource x:Key="CaptionButtonDisabledForeground" ResourceKey="SemiColorDisabledText" />
</ResourceDictionary>

View File

@@ -7,4 +7,5 @@
<StaticResource x:Key="CaptionButtonClosePointeroverBackground" ResourceKey="SemiColorHotlight" />
<StaticResource x:Key="CaptionButtonClosePressedBackground" ResourceKey="SemiColorHotlight" />
<StaticResource x:Key="CaptionButtonForeground" ResourceKey="SemiColorWindowText" />
<StaticResource x:Key="CaptionButtonDisabledForeground" ResourceKey="SemiColorGrayText" />
</ResourceDictionary>

View File

@@ -7,5 +7,6 @@
<StaticResource x:Key="CaptionButtonCloseForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="CaptionButtonClosePointeroverBackground" ResourceKey="SemiColorDangerPointerover" />
<StaticResource x:Key="CaptionButtonClosePressedBackground" ResourceKey="SemiColorDangerActive" />
<StaticResource x:Key="CaptionButtonForeground" ResourceKey="SemiColorText2" />
<StaticResource x:Key="CaptionButtonForeground" ResourceKey="SemiColorText1" />
<StaticResource x:Key="CaptionButtonDisabledForeground" ResourceKey="SemiColorDisabledText" />
</ResourceDictionary>