mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-05-03 06:21:29 +08:00
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:
32
demo/Semi.Avalonia.Demo/Pages/WindowCustomizationsPage.axaml
Normal file
32
demo/Semi.Avalonia.Demo/Pages/WindowCustomizationsPage.axaml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="Semi.Avalonia.Demo.Pages.WindowCustomizationsPage"
|
||||||
|
x:CompileBindings="True">
|
||||||
|
|
||||||
|
<StackPanel
|
||||||
|
Spacing="10"
|
||||||
|
IsEnabled="{OnFormFactor False, Desktop=True}">
|
||||||
|
<TextBlock Classes="H2" Text="Desktop properties" />
|
||||||
|
|
||||||
|
<CheckBox Content="Extend Client Area to Decorations"
|
||||||
|
IsChecked="{Binding $parent[Window].ExtendClientAreaToDecorationsHint}" />
|
||||||
|
|
||||||
|
<Slider IsEnabled="{Binding $parent[Window].ExtendClientAreaToDecorationsHint}"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Width="201" Minimum="-1" Maximum="200"
|
||||||
|
Value="{Binding $parent[Window].ExtendClientAreaTitleBarHeightHint}" />
|
||||||
|
|
||||||
|
<CheckBox Content="Can Resize"
|
||||||
|
IsChecked="{Binding $parent[Window].CanResize}" />
|
||||||
|
|
||||||
|
<CheckBox Content="Can Minimize"
|
||||||
|
IsChecked="{Binding $parent[Window].CanMinimize}" />
|
||||||
|
|
||||||
|
<CheckBox Content="Can Maximize"
|
||||||
|
IsChecked="{Binding $parent[Window].CanMaximize}"
|
||||||
|
IsEnabled="{Binding $parent[Window].CanResize}" />
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.Pages
|
||||||
|
{
|
||||||
|
public partial class WindowCustomizationsPage : UserControl
|
||||||
|
{
|
||||||
|
public WindowCustomizationsPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -278,6 +278,9 @@
|
|||||||
<TabItem Header="ThemeVariantScope">
|
<TabItem Header="ThemeVariantScope">
|
||||||
<pages:ThemeVariantDemo />
|
<pages:ThemeVariantDemo />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem Header="WindowCustomizationsPage">
|
||||||
|
<pages:WindowCustomizationsPage />
|
||||||
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
<Setter Property="Padding" Value="{StaticResource CaptionButtonPadding}" />
|
<Setter Property="Padding" Value="{StaticResource CaptionButtonPadding}" />
|
||||||
<Setter Property="Width" Value="{StaticResource CaptionButtonWidth}" />
|
<Setter Property="Width" Value="{StaticResource CaptionButtonWidth}" />
|
||||||
<Setter Property="Height" Value="{StaticResource CaptionButtonHeight}" />
|
<Setter Property="Height" Value="{StaticResource CaptionButtonHeight}" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
|
||||||
<Setter Property="WindowDecorationProperties.ElementRole" Value="DecorationsElement" />
|
<Setter Property="WindowDecorationProperties.ElementRole" Value="DecorationsElement" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
@@ -39,6 +38,10 @@
|
|||||||
<Style Selector="^:pressed">
|
<Style Selector="^:pressed">
|
||||||
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressedBackground}" />
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressedBackground}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:disabled">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonDisabledForeground}" />
|
||||||
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type WindowDrawnDecorations}" TargetType="WindowDrawnDecorations">
|
<ControlTheme x:Key="{x:Type WindowDrawnDecorations}" TargetType="WindowDrawnDecorations">
|
||||||
@@ -50,14 +53,13 @@
|
|||||||
<WindowDrawnDecorationsContent>
|
<WindowDrawnDecorationsContent>
|
||||||
<WindowDrawnDecorationsContent.Underlay>
|
<WindowDrawnDecorationsContent.Underlay>
|
||||||
<!-- Full-size: covers shadow area + frame + behind client area -->
|
<!-- Full-size: covers shadow area + frame + behind client area -->
|
||||||
<Panel>
|
<Panel Name="PART_UnderlayWrapper">
|
||||||
<Border
|
<Border
|
||||||
Name="PART_WindowBorder"
|
Name="PART_WindowBorder"
|
||||||
Margin="{TemplateBinding ShadowThickness}"
|
|
||||||
Background="{DynamicResource WindowBackground}"
|
Background="{DynamicResource WindowBackground}"
|
||||||
BorderBrush="{DynamicResource WindowBorderBrush}"
|
BorderBrush="{DynamicResource WindowBorderBrush}"
|
||||||
BorderThickness="1"
|
BorderThickness="{TemplateBinding FrameThickness}"
|
||||||
BoxShadow="{DynamicResource WindowBorderShadow}" />
|
IsHitTestVisible="False" />
|
||||||
<!-- Titlebar: background, title text, and drag area live in underlay -->
|
<!-- Titlebar: background, title text, and drag area live in underlay -->
|
||||||
<Panel Name="PART_TitleBar"
|
<Panel Name="PART_TitleBar"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
@@ -81,7 +83,6 @@
|
|||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="12,0,0,0"
|
Margin="12,0,0,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontSize="12"
|
|
||||||
Text="{TemplateBinding Title}" />
|
Text="{TemplateBinding Title}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
@@ -90,9 +91,7 @@
|
|||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
IsVisible="{TemplateBinding HasTitleBar}"
|
IsVisible="{TemplateBinding HasTitleBar}"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal">
|
||||||
Spacing="2"
|
|
||||||
TextElement.FontSize="10">
|
|
||||||
<Button
|
<Button
|
||||||
Name="PART_FullScreenButton"
|
Name="PART_FullScreenButton"
|
||||||
Theme="{StaticResource CaptionButton}"
|
Theme="{StaticResource CaptionButton}"
|
||||||
@@ -137,7 +136,7 @@
|
|||||||
WindowDecorationProperties.ElementRole="CloseButton" />
|
WindowDecorationProperties.ElementRole="CloseButton" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="12,0"
|
Margin="12,0,0,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{TemplateBinding Title}" />
|
Text="{TemplateBinding Title}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|||||||
@@ -7,5 +7,6 @@
|
|||||||
<StaticResource x:Key="CaptionButtonCloseForeground" ResourceKey="SemiColorWhite" />
|
<StaticResource x:Key="CaptionButtonCloseForeground" ResourceKey="SemiColorWhite" />
|
||||||
<StaticResource x:Key="CaptionButtonClosePointeroverBackground" ResourceKey="SemiColorDangerPointerover" />
|
<StaticResource x:Key="CaptionButtonClosePointeroverBackground" ResourceKey="SemiColorDangerPointerover" />
|
||||||
<StaticResource x:Key="CaptionButtonClosePressedBackground" ResourceKey="SemiColorDangerActive" />
|
<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>
|
</ResourceDictionary>
|
||||||
@@ -7,4 +7,5 @@
|
|||||||
<StaticResource x:Key="CaptionButtonClosePointeroverBackground" ResourceKey="SemiColorHotlight" />
|
<StaticResource x:Key="CaptionButtonClosePointeroverBackground" ResourceKey="SemiColorHotlight" />
|
||||||
<StaticResource x:Key="CaptionButtonClosePressedBackground" ResourceKey="SemiColorHotlight" />
|
<StaticResource x:Key="CaptionButtonClosePressedBackground" ResourceKey="SemiColorHotlight" />
|
||||||
<StaticResource x:Key="CaptionButtonForeground" ResourceKey="SemiColorWindowText" />
|
<StaticResource x:Key="CaptionButtonForeground" ResourceKey="SemiColorWindowText" />
|
||||||
|
<StaticResource x:Key="CaptionButtonDisabledForeground" ResourceKey="SemiColorGrayText" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -7,5 +7,6 @@
|
|||||||
<StaticResource x:Key="CaptionButtonCloseForeground" ResourceKey="SemiColorWhite" />
|
<StaticResource x:Key="CaptionButtonCloseForeground" ResourceKey="SemiColorWhite" />
|
||||||
<StaticResource x:Key="CaptionButtonClosePointeroverBackground" ResourceKey="SemiColorDangerPointerover" />
|
<StaticResource x:Key="CaptionButtonClosePointeroverBackground" ResourceKey="SemiColorDangerPointerover" />
|
||||||
<StaticResource x:Key="CaptionButtonClosePressedBackground" ResourceKey="SemiColorDangerActive" />
|
<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>
|
</ResourceDictionary>
|
||||||
Reference in New Issue
Block a user