This commit is contained in:
ShrlAlgo
2025-07-11 09:20:23 +08:00
parent c7b104f44f
commit 4d35cadb56
840 changed files with 102347 additions and 11595 deletions

View File

@@ -1,10 +1,9 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPFluent.Controls"
xmlns:primitives="clr-namespace:WPFluent.Controls.Primitives"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<sys:Double x:Key="ContentDialogMinWidth">320</sys:Double>
<sys:Double x:Key="ContentDialogMaxWidth">548</sys:Double>
@@ -24,22 +23,22 @@
<Thickness x:Key="ContentDialogTitleMargin">0,0,0,24</Thickness>
<Thickness x:Key="ContentDialogPadding">24</Thickness>
<GridLength x:Key="ContentDialogButtonSpacing">8</GridLength>
<SolidColorBrush x:Key="ContentDialogTopOverlay" Color="Transparent" />
<SolidColorBrush Color="Transparent" x:Key="LayerFillColorAltBrush" />
<FontFamily x:Key="SymbolThemeFontFamily">pack://application:,,,/WPFluent;component/Resources/Fonts/Segoe Fluent Icons.ttf#Segoe Fluent Icons</FontFamily>
<WindowChrome
x:Key="MessageBoxAeroWindowChrome"
x:Shared="False"
GlassFrameThickness="-1"
NonClientFrameEdges="None"
ResizeBorderThickness="0"
UseAeroCaptionButtons="True" />
UseAeroCaptionButtons="True"
x:Key="MessageBoxAeroWindowChrome"
x:Shared="False" />
<Style TargetType="{x:Type local:MessageBoxDialog}">
<Setter Property="Foreground" Value="{DynamicResource ContentDialogForeground}" />
<Setter Property="Background" Value="{DynamicResource ContentDialogBackground}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource SolidBackgroundFillColorBaseBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ContentDialogBorderWidth}" />
<Setter Property="BorderBrush" Value="{DynamicResource ContentDialogBorderBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource SurfaceStrokeColorDefaultBrush}" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
<Setter Property="OKButtonStyle" Value="{DynamicResource DefaultButtonStyle}" />
@@ -58,25 +57,25 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MessageBoxDialog}">
<Border x:Name="Container">
<Grid x:Name="LayoutRoot" SnapsToDevicePixels="True">
<Grid SnapsToDevicePixels="True" x:Name="LayoutRoot">
<Grid
x:Name="BackgroundElement"
MinWidth="{StaticResource ContentDialogMinWidth}"
MinHeight="{StaticResource ContentDialogMinHeight}"
MaxWidth="{StaticResource ContentDialogMaxWidth}"
MaxHeight="{StaticResource ContentDialogMaxHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FlowDirection="{TemplateBinding FlowDirection}"
RenderTransformOrigin="0.5,0.5">
HorizontalAlignment="Center"
MaxHeight="{StaticResource ContentDialogMaxHeight}"
MaxWidth="{StaticResource ContentDialogMaxWidth}"
MinHeight="{StaticResource ContentDialogMinHeight}"
MinWidth="{StaticResource ContentDialogMinWidth}"
RenderTransformOrigin="0.5,0.5"
VerticalAlignment="Center"
x:Name="BackgroundElement">
<Grid.RenderTransform>
<ScaleTransform x:Name="ScaleTransform" />
</Grid.RenderTransform>
<Border
x:Name="BackgroundBorder"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}"
Opacity="0" />
Opacity="0"
x:Name="BackgroundBorder" />
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
@@ -90,41 +89,41 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ScrollViewer
x:Name="ContentScrollViewer"
HorizontalScrollBarVisibility="Disabled"
IsTabStop="False"
VerticalScrollBarVisibility="Disabled">
<Border Padding="{StaticResource ContentDialogPadding}" Background="{DynamicResource ContentDialogTopOverlay}">
VerticalScrollBarVisibility="Disabled"
x:Name="ContentScrollViewer">
<Border Background="{DynamicResource LayerFillColorAltBrush}" Padding="{StaticResource ContentDialogPadding}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentControl
x:Name="Title"
Margin="{StaticResource ContentDialogTitleMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="{TemplateBinding Caption}"
ContentTemplate="{TemplateBinding CaptionTemplate}"
FontFamily="{DynamicResource TextThemeFontFamily}"
FontSize="20"
FontWeight="SemiBold"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="Left"
IsTabStop="False"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
Margin="{StaticResource ContentDialogTitleMargin}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="Top"
x:Name="Title">
<ContentControl.Template>
<ControlTemplate TargetType="ContentControl">
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</ControlTemplate>
</ContentControl.Template>
</ContentControl>
<Grid x:Name="MessagePanel" Grid.Row="1">
<Grid Grid.Row="1" x:Name="MessagePanel">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@@ -132,23 +131,23 @@
<Grid Grid.Column="0">
<!-- UserIconBox is not supported nowadays -->
<ContentControl
x:Name="UserIconBox"
Margin="0,0,16,0"
VerticalAlignment="Center"
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.IconElement}"
IsTabStop="False"
Visibility="Collapsed" />
Margin="0,0,16,0"
VerticalAlignment="Center"
Visibility="Collapsed"
x:Name="UserIconBox" />
<TextBlock
x:Name="UserIconBlock"
Width="36"
Height="36"
Margin="4,0,16,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="36"
Foreground="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MessageBoxIcon, Converter={x:Static local:MessageBoxIconForegroundConverter.New}}"
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MessageBoxIcon, Converter={x:Static local:MessageBoxIconConverter.New}}" />
Height="36"
HorizontalAlignment="Center"
Margin="4,0,16,0"
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MessageBoxIcon, Converter={x:Static local:MessageBoxIconConverter.New}}"
VerticalAlignment="Top"
Width="36"
x:Name="UserIconBlock" />
</Grid>
<Grid Grid.Column="1" VerticalAlignment="Center">
<Grid.Resources>
@@ -161,9 +160,9 @@
<ContentPresenter Content="{Binding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</DataTemplate>
<local:MessageBoxContentTemplateSelector
x:Key="TemplateSelector"
DefaultTemplate="{StaticResource DefaultTemplate}"
StringTemplate="{StaticResource StringTemplate}" />
StringTemplate="{StaticResource StringTemplate}"
x:Key="TemplateSelector" />
</Grid.Resources>
<ContentPresenter ContentTemplateSelector="{StaticResource TemplateSelector}" />
</Grid>
@@ -172,47 +171,47 @@
</Border>
</ScrollViewer>
<Grid
x:Name="CommandSpace"
Grid.Row="1"
Margin="{StaticResource ContentDialogPadding}"
HorizontalAlignment="Stretch"
KeyboardNavigation.DirectionalNavigation="Contained"
Margin="{StaticResource ContentDialogPadding}"
VerticalAlignment="Bottom"
KeyboardNavigation.DirectionalNavigation="Contained">
x:Name="CommandSpace">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="PrimaryColumn" Width="*" />
<ColumnDefinition x:Name="FirstSpacer" Width="{StaticResource ContentDialogButtonSpacing}" />
<ColumnDefinition x:Name="SecondaryColumn" Width="*" />
<ColumnDefinition x:Name="SecondSpacer" Width="{StaticResource ContentDialogButtonSpacing}" />
<ColumnDefinition x:Name="CloseColumn" Width="*" />
<ColumnDefinition Width="*" x:Name="PrimaryColumn" />
<ColumnDefinition Width="{StaticResource ContentDialogButtonSpacing}" x:Name="FirstSpacer" />
<ColumnDefinition Width="*" x:Name="SecondaryColumn" />
<ColumnDefinition Width="{StaticResource ContentDialogButtonSpacing}" x:Name="SecondSpacer" />
<ColumnDefinition Width="*" x:Name="CloseColumn" />
</Grid.ColumnDefinitions>
<Button
x:Name="PART_OKButton"
Grid.Column="0"
HorizontalAlignment="Stretch"
Content="{Binding TemplateSettings.OKButtonText, RelativeSource={RelativeSource Mode=TemplatedParent}}"
FontFamily="{DynamicResource TextThemeFontFamily}"
Style="{TemplateBinding OKButtonStyle}" />
<Button
x:Name="PART_YesButton"
Grid.Column="0"
HorizontalAlignment="Stretch"
Style="{TemplateBinding OKButtonStyle}"
x:Name="PART_OKButton" />
<Button
Content="{Binding TemplateSettings.YesButtonText, RelativeSource={RelativeSource Mode=TemplatedParent}}"
FontFamily="{DynamicResource TextThemeFontFamily}"
Style="{TemplateBinding YesButtonStyle}" />
<Button
x:Name="PART_NoButton"
Grid.Column="2"
Grid.Column="0"
HorizontalAlignment="Stretch"
Style="{TemplateBinding YesButtonStyle}"
x:Name="PART_YesButton" />
<Button
Content="{Binding TemplateSettings.NoButtonText, RelativeSource={RelativeSource Mode=TemplatedParent}}"
FontFamily="{DynamicResource TextThemeFontFamily}"
Style="{TemplateBinding NoButtonStyle}" />
<Button
x:Name="PART_CancelButton"
Grid.Column="4"
Grid.Column="2"
HorizontalAlignment="Stretch"
Style="{TemplateBinding NoButtonStyle}"
x:Name="PART_NoButton" />
<Button
Content="{Binding TemplateSettings.CancelButtonText, RelativeSource={RelativeSource Mode=TemplatedParent}}"
FontFamily="{DynamicResource TextThemeFontFamily}"
Style="{TemplateBinding CancelButtonStyle}" />
Grid.Column="4"
HorizontalAlignment="Stretch"
Style="{TemplateBinding CancelButtonStyle}"
x:Name="PART_CancelButton" />
</Grid>
</Grid>
</Border>
@@ -325,15 +324,15 @@
</Border>
<ControlTemplate.Triggers>
<Trigger Property="WindowStyle" Value="None">
<Setter TargetName="BackgroundBorder" Property="Opacity" Value="0" />
<Setter Property="Opacity" TargetName="BackgroundBorder" Value="0" />
</Trigger>
<!-- OKAsDefaultButton -->
<Trigger SourceName="DefaultButtonStatesListener" Property="CurrentStateName" Value="OKAsDefaultButton">
<Setter TargetName="PART_OKButton" Property="Style" Value="{DynamicResource AccentButtonStyle}" />
<Trigger Property="CurrentStateName" SourceName="DefaultButtonStatesListener" Value="OKAsDefaultButton">
<Setter Property="Style" TargetName="PART_OKButton" Value="{DynamicResource AccentButtonStyle}" />
</Trigger>
<!-- YesAsDefaultButton -->
<Trigger SourceName="DefaultButtonStatesListener" Property="CurrentStateName" Value="YesAsDefaultButton">
<Setter TargetName="PART_YesButton" Property="Style" Value="{DynamicResource AccentButtonStyle}" />
<Trigger Property="CurrentStateName" SourceName="DefaultButtonStatesListener" Value="YesAsDefaultButton">
<Setter Property="Style" TargetName="PART_YesButton" Value="{DynamicResource AccentButtonStyle}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>