2025-07-11 09:20:23 +08:00
|
|
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
|
xmlns:controls="clr-namespace:AntdWpf.Controls"
|
|
|
|
|
xmlns:Behaviors="clr-namespace:AntdWpf.Behaviors"
|
|
|
|
|
xmlns:helpers="clr-namespace:AntdWpf.Helpers">
|
|
|
|
|
|
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
|
|
|
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Animations.xaml" />
|
|
|
|
|
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Control.xaml" />
|
|
|
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
|
|
|
|
|
|
<Style BasedOn="{StaticResource Ant.Control}" TargetType="{x:Type controls:Alert}">
|
|
|
|
|
<Setter Property="Padding" Value="15 8" />
|
|
|
|
|
<Setter Property="IsTabStop" Value="False" />
|
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|
|
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
|
|
|
|
|
<Setter Property="KeyboardNavigation.DirectionalNavigation" Value="None" />
|
|
|
|
|
<Setter Property="IconBrush" Value="{DynamicResource InfoBrush}" />
|
|
|
|
|
<Setter Property="BorderThickness" Value="{DynamicResource BorderThicknessBase}" />
|
2025-07-12 23:31:32 +08:00
|
|
|
<Setter Property="helpers:AntdControl.BorderStyle" Value="{DynamicResource BorderStyleBase}" />
|
|
|
|
|
<Setter Property="helpers:AntdControl.CornerRadius" Value="{DynamicResource BorderRadiusBase}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="Background" Value="{Binding IconBrush, Mode=OneWay, RelativeSource={RelativeSource Self},
|
|
|
|
|
Converter={StaticResource ColorPaletteConverter}, ConverterParameter=1}" />
|
|
|
|
|
<Setter Property="BorderBrush" Value="{Binding IconBrush, Mode=OneWay, RelativeSource={RelativeSource Self},
|
|
|
|
|
Converter={StaticResource ColorPaletteConverter}, ConverterParameter=3}" />
|
|
|
|
|
<Setter Property="RenderTransform">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ScaleTransform />
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Setter Property="Behaviors:StylizedBehaviors.Behaviors">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<Behaviors:StylizedBehaviorCollection>
|
|
|
|
|
<Behaviors:VisibilityBehavior>
|
|
|
|
|
<Behaviors:VisibilityBehavior.Leave>
|
|
|
|
|
<Storyboard FillBehavior="Stop">
|
|
|
|
|
<DoubleAnimation Storyboard.TargetProperty="Opacity"
|
|
|
|
|
EasingFunction="{StaticResource EaseInOutCirc}"
|
|
|
|
|
Duration="0:0:0.3"
|
|
|
|
|
From="1"
|
|
|
|
|
To="0" />
|
|
|
|
|
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY"
|
|
|
|
|
EasingFunction="{StaticResource EaseInOutCirc}"
|
|
|
|
|
Duration="0:0:0.3"
|
|
|
|
|
From="1"
|
|
|
|
|
To="0" />
|
|
|
|
|
</Storyboard>
|
|
|
|
|
</Behaviors:VisibilityBehavior.Leave>
|
|
|
|
|
</Behaviors:VisibilityBehavior>
|
|
|
|
|
</Behaviors:StylizedBehaviorCollection>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type controls:Alert}">
|
2025-07-12 23:31:32 +08:00
|
|
|
<controls:AntdBorder UseLayoutRounding="True"
|
2025-07-11 09:20:23 +08:00
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
2025-07-12 23:31:32 +08:00
|
|
|
BorderStyle="{TemplateBinding helpers:AntdControl.BorderStyle}"
|
|
|
|
|
CornerRadius="{TemplateBinding helpers:AntdControl.CornerRadius}">
|
2025-07-11 09:20:23 +08:00
|
|
|
<Grid>
|
|
|
|
|
<Grid.Resources>
|
|
|
|
|
<!-- TODO Does it have other uses? -->
|
|
|
|
|
<Style x:Key="Ant.AlertCloseButton" TargetType="{x:Type Button}">
|
|
|
|
|
<Setter Property="Padding" Value="0" />
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource LinkBrush}" />
|
|
|
|
|
<Setter Property="FontSize" Value="{DynamicResource FontSizeSmall}" />
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type Button}">
|
|
|
|
|
<ControlTemplate.Resources>
|
|
|
|
|
<Style TargetType="{x:Type controls:Icon}">
|
|
|
|
|
<Setter Property="Opacity" Value="0.65" />
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource HeadingBrush}" />
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="Opacity" Value="0.85" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<DataTrigger Binding="{Binding IsPressed, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
|
|
|
|
|
Value="True">
|
|
|
|
|
<Setter Property="Opacity" Value="1" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</ControlTemplate.Resources>
|
|
|
|
|
<ContentPresenter />
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource LinkHoverBrush}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsPressed" Value="True">
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource LinkActiveBrush}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</Grid.Resources>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<!-- Icon -->
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
<!-- Text -->
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<!-- Close Button -->
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<!-- Message -->
|
|
|
|
|
<RowDefinition />
|
|
|
|
|
<!-- Description -->
|
|
|
|
|
<RowDefinition />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
<!-- Icon -->
|
|
|
|
|
<controls:Icon x:Name="Icon"
|
|
|
|
|
Theme="Filled"
|
|
|
|
|
Margin="0 0 8 0"
|
|
|
|
|
Type="{TemplateBinding Icon}"
|
|
|
|
|
Foreground="{TemplateBinding IconBrush}"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
Visibility="{Binding ShowIcon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent},
|
|
|
|
|
Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
|
|
|
<!-- Message -->
|
|
|
|
|
<ContentPresenter x:Name="Message"
|
|
|
|
|
Grid.Column="1"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
Content="{Binding Message, RelativeSource={RelativeSource TemplatedParent},
|
|
|
|
|
Converter={StaticResource StringToTextBlockConverter}}" />
|
|
|
|
|
<!-- Description -->
|
|
|
|
|
<ContentPresenter x:Name="Description"
|
|
|
|
|
Grid.Row="1"
|
|
|
|
|
Grid.Column="1"
|
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
Visibility="Collapsed"
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
Content="{Binding Description, RelativeSource={RelativeSource TemplatedParent},
|
|
|
|
|
Converter={StaticResource StringToTextBlockConverter}}" />
|
|
|
|
|
<!-- Close Button -->
|
|
|
|
|
<Button x:Name="PART_Close"
|
|
|
|
|
Grid.Column="2"
|
|
|
|
|
Style="{StaticResource Ant.AlertCloseButton}"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
|
|
|
|
</Grid>
|
2025-07-12 23:31:32 +08:00
|
|
|
</controls:AntdBorder>
|
2025-07-11 09:20:23 +08:00
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<!-- With Description -->
|
|
|
|
|
<DataTrigger Binding="{Binding Description, Mode=OneWay, RelativeSource={RelativeSource Self},
|
|
|
|
|
Converter={StaticResource IsNullConverter}}" Value="False">
|
|
|
|
|
<Setter TargetName="Icon" Property="FontSize" Value="24" />
|
|
|
|
|
<Setter TargetName="Icon" Property="Theme" Value="Outlined" />
|
|
|
|
|
<Setter TargetName="Message" Property="Margin" Value="0 0 0 4" />
|
|
|
|
|
<Setter TargetName="Description" Property="Visibility" Value="Visible" />
|
|
|
|
|
<Setter TargetName="PART_Close" Property="FontSize" Value="{DynamicResource FontSizeBase}" />
|
|
|
|
|
<Setter TargetName="Message" Property="TextElement.FontSize" Value="{DynamicResource FontSizeLarge}" />
|
|
|
|
|
<Setter TargetName="Message" Property="TextElement.Foreground" Value="{DynamicResource HeadingBrush}" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="Type" Value="Info">
|
|
|
|
|
<Setter Property="Icon" Value="info-circle" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Type" Value="Success">
|
|
|
|
|
<Setter Property="Icon" Value="check-circle" />
|
|
|
|
|
<Setter Property="IconBrush" Value="{DynamicResource SuccessBrush}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Type" Value="Warning">
|
|
|
|
|
<Setter Property="Icon" Value="exclamation-circle" />
|
|
|
|
|
<Setter Property="IconBrush" Value="{DynamicResource WarningBrush}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Type" Value="Error">
|
|
|
|
|
<Setter Property="Icon" Value="close-circle" />
|
|
|
|
|
<Setter Property="IconBrush" Value="{DynamicResource ErrorBrush}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Banner" Value="True">
|
|
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
2025-07-12 23:31:32 +08:00
|
|
|
<Setter Property="helpers:AntdControl.CornerRadius" Value="0" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
|
|
</ResourceDictionary>
|