feat: unified OverlayCloseButton.
This commit is contained in:
4
src/Ursa.Themes.Semi/Compatibles/Theme.axaml
Normal file
4
src/Ursa.Themes.Semi/Compatibles/Theme.axaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<StaticResource x:Key="NotificationCloseButton" ResourceKey="OverlayCloseButton" />
|
||||||
|
<StaticResource x:Key="ToastCloseButton" ResourceKey="OverlayCloseButton" />
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceInclude Source="/Compatibles/Icon.axaml" />
|
<ResourceInclude Source="/Compatibles/Icon.axaml" />
|
||||||
|
<ResourceInclude Source="/Compatibles/Theme.axaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
Margin="{DynamicResource BannerCloseButtonMargin}"
|
Margin="{DynamicResource BannerCloseButtonMargin}"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Theme="{DynamicResource NotificationCloseButton}"
|
Theme="{DynamicResource OverlayCloseButton}"
|
||||||
IsVisible="{TemplateBinding CanClose}" />
|
IsVisible="{TemplateBinding CanClose}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@@ -1,28 +1,44 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<!-- Add Resources Here -->
|
<Design.PreviewWith>
|
||||||
<ControlTheme x:Key="CloseButton" TargetType="Button">
|
<StackPanel Orientation="Horizontal" Margin="20">
|
||||||
|
<Button Theme="{DynamicResource CloseButton}" />
|
||||||
|
<Button Theme="{DynamicResource OverlayCloseButton}" />
|
||||||
|
<Button Theme="{DynamicResource NotificationCloseButton}" />
|
||||||
|
<Button Theme="{DynamicResource ToastCloseButton}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Design.PreviewWith>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="OverlayCloseButton" TargetType="Button">
|
||||||
<Setter Property="CornerRadius" Value="6" />
|
<Setter Property="CornerRadius" Value="6" />
|
||||||
<Setter Property="Margin" Value="0, 4" />
|
<Setter Property="Height" Value="24" />
|
||||||
|
<Setter Property="Width" Value="24" />
|
||||||
<Setter Property="Padding" Value="4" />
|
<Setter Property="Padding" Value="4" />
|
||||||
<Setter Property="Height" Value="28" />
|
|
||||||
<Setter Property="Width" Value="28" />
|
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border
|
<Border
|
||||||
Name="PART_Border"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
Padding="{TemplateBinding Padding}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="12"
|
Foreground="{DynamicResource SemiColorText1}"
|
||||||
Height="12"
|
Theme="{StaticResource InnerPathIcon}"
|
||||||
Data="{DynamicResource WindowCloseIconGlyph}"/>
|
Data="{DynamicResource SemiIconClose}" />
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
<Style Selector="^:pointerover /template/ Border">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource SemiColorFill1}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pressed /template/ Border">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource SemiColorFill2}" />
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme
|
||||||
|
x:Key="CloseButton"
|
||||||
|
BasedOn="{StaticResource OverlayCloseButton}"
|
||||||
|
TargetType="Button">
|
||||||
<Style Selector="^:pointerover /template/ Border">
|
<Style Selector="^:pointerover /template/ Border">
|
||||||
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePointeroverBackground}" />
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePointeroverBackground}" />
|
||||||
</Style>
|
</Style>
|
||||||
@@ -38,34 +54,4 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="OverlayCloseButton" TargetType="Button">
|
|
||||||
<Setter Property="CornerRadius" Value="6" />
|
|
||||||
<Setter Property="Margin" Value="0, 4" />
|
|
||||||
<Setter Property="Padding" Value="4" />
|
|
||||||
<Setter Property="Height" Value="28" />
|
|
||||||
<Setter Property="Width" Value="28" />
|
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
|
||||||
<Setter Property="Template">
|
|
||||||
<ControlTemplate TargetType="Button">
|
|
||||||
<Border
|
|
||||||
Name="PART_Border"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
|
||||||
Background="Transparent"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
|
||||||
<PathIcon
|
|
||||||
Width="12"
|
|
||||||
Height="12"
|
|
||||||
Data="{DynamicResource WindowCloseIconGlyph}"/>
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter>
|
|
||||||
<Style Selector="^:pointerover /template/ Border">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed /template/ Border">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
x:Name="PART_CloseButton"
|
x:Name="PART_CloseButton"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Theme="{StaticResource NotificationCloseButton}"
|
Theme="{StaticResource OverlayCloseButton}"
|
||||||
IsVisible="{TemplateBinding ShowClose}"
|
IsVisible="{TemplateBinding ShowClose}"
|
||||||
u:MessageCard.CloseOnClick="True" />
|
u:MessageCard.CloseOnClick="True" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
@@ -432,32 +432,4 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="NotificationCloseButton" TargetType="Button">
|
|
||||||
<Setter Property="CornerRadius" Value="6" />
|
|
||||||
<Setter Property="Height" Value="24" />
|
|
||||||
<Setter Property="Width" Value="24" />
|
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource NotificationCardCloseButtonForeground}" />
|
|
||||||
<Setter Property="Template">
|
|
||||||
<ControlTemplate TargetType="Button">
|
|
||||||
<Border
|
|
||||||
Name="PART_Border"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
|
||||||
Background="Transparent"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
|
||||||
<PathIcon
|
|
||||||
Width="10"
|
|
||||||
Height="10"
|
|
||||||
Data="{DynamicResource WindowCloseIconGlyph}" />
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter>
|
|
||||||
<Style Selector="^:pointerover /template/ Border">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed /template/ Border">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
</ContentControl>
|
</ContentControl>
|
||||||
<Button
|
<Button
|
||||||
x:Name="PART_CloseButton"
|
x:Name="PART_CloseButton"
|
||||||
Theme="{StaticResource ToastCloseButton}"
|
Theme="{StaticResource OverlayCloseButton}"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
IsVisible="{TemplateBinding ShowClose}"
|
IsVisible="{TemplateBinding ShowClose}"
|
||||||
u:MessageCard.CloseOnClick="True" />
|
u:MessageCard.CloseOnClick="True" />
|
||||||
@@ -220,31 +220,4 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="ToastCloseButton" TargetType="Button">
|
|
||||||
<Setter Property="CornerRadius" Value="6" />
|
|
||||||
<Setter Property="Height" Value="24" />
|
|
||||||
<Setter Property="Width" Value="24" />
|
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
|
||||||
<Setter Property="Template">
|
|
||||||
<ControlTemplate TargetType="Button">
|
|
||||||
<Border
|
|
||||||
Name="PART_Border"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
|
||||||
Background="Transparent"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
|
||||||
<PathIcon
|
|
||||||
Width="10"
|
|
||||||
Height="10"
|
|
||||||
Data="{DynamicResource WindowCloseIconGlyph}" />
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter>
|
|
||||||
<Style Selector="^:pointerover /template/ Border">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed /template/ Border">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
Reference in New Issue
Block a user