feat: add PopConfirm resource dictionary and update styles.

This commit is contained in:
Zhang Dian
2025-04-25 00:25:03 +08:00
parent 5bfa472c1e
commit 3035a519ec
7 changed files with 61 additions and 40 deletions

View File

@@ -20,9 +20,14 @@
Name="{x:Static u:PopConfirm.PART_Popup}"
Placement="{TemplateBinding Placement}">
<Border
Theme="{DynamicResource CardBorder}"
MinHeight="160"
MinWidth="280">
MaxWidth="{DynamicResource PopConfirmBorderMaxWidth}"
Padding="{DynamicResource PopConfirmBorderPadding}"
Margin="{DynamicResource PopConfirmBorderMargin}"
Background="{DynamicResource PopConfirmBackground}"
BorderBrush="{DynamicResource PopConfirmBorderBrush}"
BorderThickness="{DynamicResource PopConfirmBorderThickness}"
CornerRadius="{DynamicResource PopConfirmBorderCornerRadius}"
BoxShadow="{DynamicResource PopConfirmBorderBoxShadows}">
<Grid
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
RowDefinitions="*, Auto"
@@ -30,41 +35,44 @@
<!-- Icon Area -->
<Panel
Grid.Column="0"
Margin="{DynamicResource BannerIconMargin}"
Margin="{DynamicResource PopConfirmIconMargin}"
VerticalAlignment="Top">
<ContentPresenter
Content="{TemplateBinding Icon}" />
<PathIcon
Name="PART_BuildInIcon"
Theme="{DynamicResource InnerPathIcon}"
Classes="ExtraLarge"
Data="{DynamicResource BannerWarningIconGeometry}"
Foreground="{DynamicResource BannerWarningBorderBrush}"
Classes="Large"
IsVisible="{TemplateBinding Icon, Converter={x:Static ObjectConverters.IsNull}}" />
</Panel>
<StackPanel Grid.Row="0"
<StackPanel
Grid.Row="0"
Grid.Column="1"
Spacing="2">
Spacing="8">
<ContentPresenter
Content="{TemplateBinding PopupHeader}"
ContentTemplate="{TemplateBinding PopupHeaderTemplate}"
TextTrimming="CharacterEllipsis"
TextElement.FontSize="{DynamicResource BannerTitleFontSize}"
TextElement.FontWeight="{DynamicResource TextBlockTitleFontWeight}" />
TextElement.FontSize="{DynamicResource PopConfirmTitleFontSize}"
TextElement.FontWeight="{DynamicResource PopConfirmTitleFontWeight}" />
<ContentPresenter
Content="{TemplateBinding PopupContent}"
ContentTemplate="{TemplateBinding PopupContentTemplate}"
Foreground="{DynamicResource PopConfirmContentForeground}"
TextWrapping="Wrap" />
</StackPanel>
<StackPanel Grid.Row="1"
<StackPanel
Grid.Row="1"
Grid.Column="0"
Margin="0 8 0 0"
Grid.ColumnSpan="2"
Margin="0 25 0 0"
Spacing="8"
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button
Name="{x:Static u:PopConfirm.PART_CancelButton}"
Margin="0 0 8 0"
Content="{DynamicResource STRING_MENU_DIALOG_CANCEL}"
Command="{TemplateBinding CancelCommand}"
CommandParameter="{TemplateBinding CancelCommandParameter}" />
@@ -74,7 +82,6 @@
Content="{DynamicResource STRING_MENU_DIALOG_OK}"
Command="{TemplateBinding ConfirmCommand}"
CommandParameter="{TemplateBinding ConfirmCommandParameter}" />
</StackPanel>
</Grid>
</Border>
@@ -92,39 +99,27 @@
</Style>
<Style Selector="^.Information">
<Style
Selector="^ /template/ PathIcon#PART_BuildInIcon">
<Setter Property="Data"
Value="{DynamicResource BannerInformationIconGeometry}" />
<Setter Property="Foreground"
Value="{DynamicResource BannerInformationBorderBrush}" />
<Style Selector="^ /template/ PathIcon#PART_BuildInIcon">
<Setter Property="Data" Value="{DynamicResource BannerInformationIconGeometry}" />
<Setter Property="Foreground" Value="{DynamicResource BannerInformationBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Success">
<Style
Selector="^ /template/ PathIcon#PART_BuildInIcon">
<Setter Property="Data"
Value="{DynamicResource BannerSuccessIconGeometry}" />
<Setter Property="Foreground"
Value="{DynamicResource BannerSuccessBorderBrush}" />
<Style Selector="^ /template/ PathIcon#PART_BuildInIcon">
<Setter Property="Data" Value="{DynamicResource BannerSuccessIconGeometry}" />
<Setter Property="Foreground" Value="{DynamicResource BannerSuccessBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Warning">
<Style
Selector="^ /template/ PathIcon#PART_BuildInIcon">
<Setter Property="Data"
Value="{DynamicResource BannerWarningIconGeometry}" />
<Setter Property="Foreground"
Value="{DynamicResource BannerWarningBorderBrush}" />
<Style Selector="^ /template/ PathIcon#PART_BuildInIcon">
<Setter Property="Data" Value="{DynamicResource BannerWarningIconGeometry}" />
<Setter Property="Foreground" Value="{DynamicResource BannerWarningBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Error">
<Style
Selector="^ /template/ PathIcon#PART_BuildInIcon">
<Setter Property="Data"
Value="{DynamicResource BannerErrorIconGeometry}" />
<Setter Property="Foreground"
Value="{DynamicResource BannerErrorBorderBrush}" />
<Style Selector="^ /template/ PathIcon#PART_BuildInIcon">
<Setter Property="Data" Value="{DynamicResource BannerErrorIconGeometry}" />
<Setter Property="Foreground" Value="{DynamicResource BannerErrorBorderBrush}" />
</Style>
</Style>
</ControlTheme>

View File

@@ -0,0 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="PopConfirmBackground">#43444A</SolidColorBrush>
<SolidColorBrush x:Key="PopConfirmBorderBrush" Opacity="0.08" Color="White" />
<SolidColorBrush x:Key="PopConfirmContentForeground" Opacity="0.6" Color="#F9F9F9" />
<BoxShadows x:Key="PopConfirmBorderBoxShadows">inset 0 0 0 1 #1AFFFFFF, 0 4 14 #40000000</BoxShadows>
</ResourceDictionary>

View File

@@ -15,6 +15,7 @@
<ResourceInclude Source="NavigationMenu.axaml" />
<ResourceInclude Source="NotificationShared.axaml" />
<ResourceInclude Source="Pagination.axaml" />
<ResourceInclude Source="PopConfirm.axaml" />
<ResourceInclude Source="Rating.axaml" />
<ResourceInclude Source="SelectionList.axaml" />
<ResourceInclude Source="Skeleton.axaml" />

View File

@@ -0,0 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="PopConfirmBackground">White</SolidColorBrush>
<SolidColorBrush x:Key="PopConfirmBorderBrush" Opacity="0.08" Color="#1C1F23" />
<SolidColorBrush x:Key="PopConfirmContentForeground" Opacity="0.62" Color="#1C1F23" />
<BoxShadows x:Key="PopConfirmBorderBoxShadows">0 0 1 #4A000000, 0 4 14 #1A000000</BoxShadows>
</ResourceDictionary>

View File

@@ -15,6 +15,7 @@
<ResourceInclude Source="NavigationMenu.axaml" />
<ResourceInclude Source="NotificationShared.axaml" />
<ResourceInclude Source="Pagination.axaml" />
<ResourceInclude Source="PopConfirm.axaml" />
<ResourceInclude Source="Rating.axaml" />
<ResourceInclude Source="SelectionList.axaml" />
<ResourceInclude Source="Skeleton.axaml" />

View File

@@ -0,0 +1,11 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Double x:Key="PopConfirmBorderMaxWidth">400</x:Double>
<Thickness x:Key="PopConfirmBorderPadding">20 24 24 24</Thickness>
<Thickness x:Key="PopConfirmBorderMargin">4</Thickness>
<Thickness x:Key="PopConfirmBorderThickness">1</Thickness>
<CornerRadius x:Key="PopConfirmBorderCornerRadius">6</CornerRadius>
<Thickness x:Key="PopConfirmIconMargin">0 0 12 0</Thickness>
<x:Double x:Key="PopConfirmTitleFontSize">16</x:Double>
<FontWeight x:Key="PopConfirmTitleFontWeight">600</FontWeight>
</ResourceDictionary>

View File

@@ -16,6 +16,7 @@
<ResourceInclude Source="NavigationMenu.axaml" />
<ResourceInclude Source="Notification.axaml" />
<ResourceInclude Source="Pagination.axaml" />
<ResourceInclude Source="PopConfirm.axaml" />
<ResourceInclude Source="Rating.axaml" />
<ResourceInclude Source="Resizer.axaml" />
<ResourceInclude Source="ScrollToButton.axaml" />