2025-07-31 20:12:01 +08:00
|
|
|
<ResourceDictionary
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2025-08-20 12:10:13 +08:00
|
|
|
xmlns:assists="clr-namespace:NeumUI.Assists"
|
|
|
|
|
xmlns:controls="clr-namespace:NeumUI.Controls"
|
|
|
|
|
xmlns:conv="clr-namespace:NeumUI.Converters"
|
2025-07-31 20:12:01 +08:00
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
2025-08-20 12:10:13 +08:00
|
|
|
<ResourceDictionary Source="/NeumUI;component/Animations/Animations.xaml" />
|
|
|
|
|
<ResourceDictionary Source="/NeumUI;component/Assets/CommonGeometry.xaml" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
|
|
2025-08-12 23:08:54 +08:00
|
|
|
<Style TargetType="{x:Type controls:Alert}">
|
2025-07-31 20:12:01 +08:00
|
|
|
<Setter Property="Padding" Value="15,8" />
|
2025-08-12 23:08:54 +08:00
|
|
|
<!--<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />-->
|
2025-07-11 09:20:23 +08:00
|
|
|
<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" />
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="IconBrush" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
|
|
|
<Setter Property="assists:ControlAssist.CornerRadius" Value="4" />
|
2025-07-31 20:12:24 +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}" />-->
|
2025-08-12 23:08:54 +08:00
|
|
|
<!--<Setter Property="Background" Value="{DynamicResource PrimaryHighlightBrush}" />
|
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />-->
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="RenderTransform">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ScaleTransform />
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
2025-08-12 23:08:54 +08:00
|
|
|
<!--<Setter Property="b:StylizedBehaviors.Behaviors">
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter.Value>
|
2025-07-31 20:12:24 +08:00
|
|
|
<b:StylizedBehaviorCollection>
|
|
|
|
|
<b:VisibilityBehavior>
|
|
|
|
|
<b:VisibilityBehavior.Leave>
|
2025-07-11 09:20:23 +08:00
|
|
|
<Storyboard FillBehavior="Stop">
|
2025-07-31 20:12:01 +08:00
|
|
|
<DoubleAnimation
|
|
|
|
|
Duration="0:0:0.3"
|
|
|
|
|
EasingFunction="{StaticResource EaseInOutCirc}"
|
|
|
|
|
From="1"
|
|
|
|
|
Storyboard.TargetProperty="Opacity"
|
|
|
|
|
To="0" />
|
|
|
|
|
<DoubleAnimation
|
|
|
|
|
Duration="0:0:0.3"
|
|
|
|
|
EasingFunction="{StaticResource EaseInOutCirc}"
|
|
|
|
|
From="1"
|
|
|
|
|
Storyboard.TargetProperty="RenderTransform.ScaleY"
|
|
|
|
|
To="0" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Storyboard>
|
2025-07-31 20:12:24 +08:00
|
|
|
</b:VisibilityBehavior.Leave>
|
|
|
|
|
</b:VisibilityBehavior>
|
|
|
|
|
</b:StylizedBehaviorCollection>
|
2025-07-11 09:20:23 +08:00
|
|
|
</Setter.Value>
|
2025-08-12 23:08:54 +08:00
|
|
|
</Setter>-->
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type controls:Alert}">
|
2025-08-12 23:08:54 +08:00
|
|
|
<Border
|
2025-07-31 20:12:01 +08:00
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
2025-08-12 23:08:54 +08:00
|
|
|
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
2025-07-31 20:12:01 +08:00
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
|
|
|
UseLayoutRounding="True">
|
2025-07-11 09:20:23 +08:00
|
|
|
<Grid>
|
|
|
|
|
<Grid.Resources>
|
2025-08-20 12:10:13 +08:00
|
|
|
<!-- TODO 是否可复用? -->
|
2025-08-12 23:08:54 +08:00
|
|
|
<Style TargetType="{x:Type Button}" x:Key="AlertCloseButton">
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="Padding" Value="0" />
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
|
|
|
<Setter Property="FontSize" Value="12" />
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type Button}">
|
|
|
|
|
<ControlTemplate.Resources>
|
2025-08-12 23:08:54 +08:00
|
|
|
<Style TargetType="{x:Type controls:SymbolIcon}">
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="Opacity" Value="0.65" />
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="Opacity" Value="0.85" />
|
|
|
|
|
</Trigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
<DataTrigger Binding="{Binding IsPressed, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" Value="True">
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="Opacity" Value="1" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</ControlTemplate.Resources>
|
|
|
|
|
<ContentPresenter />
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ControlStrongBackgroundFocusedBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsPressed" Value="True">
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ControlStrongBackgroundBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</Grid.Resources>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- Icon -->
|
2025-07-11 09:20:23 +08:00
|
|
|
<ColumnDefinition Width="Auto" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- Text -->
|
2025-07-11 09:20:23 +08:00
|
|
|
<ColumnDefinition Width="*" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- Close Button -->
|
2025-07-11 09:20:23 +08:00
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<Grid.RowDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- Message -->
|
2025-07-11 09:20:23 +08:00
|
|
|
<RowDefinition />
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- Description -->
|
2025-07-11 09:20:23 +08:00
|
|
|
<RowDefinition />
|
|
|
|
|
</Grid.RowDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- Icon -->
|
2025-08-12 23:08:54 +08:00
|
|
|
<Viewbox
|
|
|
|
|
Margin="0,0,8,0"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
Width="{TemplateBinding FontSize}"
|
|
|
|
|
x:Name="Icon">
|
|
|
|
|
<Path
|
|
|
|
|
Fill="{TemplateBinding IconBrush}"
|
|
|
|
|
Visibility="{Binding ShowIcon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static conv:BooleanToVisibilityConverter.CollapsedInstance}}"
|
|
|
|
|
x:Name="IconPath" />
|
|
|
|
|
</Viewbox>
|
|
|
|
|
|
|
|
|
|
<!--<controls:SymbolIcon
|
2025-07-31 20:12:01 +08:00
|
|
|
Foreground="{TemplateBinding IconBrush}"
|
|
|
|
|
Margin="0,0,8,0"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2025-08-12 23:08:54 +08:00
|
|
|
Visibility="{Binding ShowIcon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static conv:BooleanToVisibilityConverter.CollapsedInstance}}"
|
|
|
|
|
x:Name="Icon" />-->
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- Message -->
|
|
|
|
|
<ContentPresenter
|
2025-08-12 23:08:54 +08:00
|
|
|
Content="{Binding Message, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-07-31 20:12:01 +08:00
|
|
|
Grid.Column="1"
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
x:Name="Message" />
|
|
|
|
|
<!-- Description -->
|
|
|
|
|
<ContentPresenter
|
2025-08-12 23:08:54 +08:00
|
|
|
Content="{Binding Description, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-07-31 20:12:01 +08:00
|
|
|
Grid.Column="1"
|
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
Grid.Row="1"
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2025-08-12 23:08:54 +08:00
|
|
|
TextElement.Foreground="{DynamicResource TextSecondaryBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
Visibility="Collapsed"
|
|
|
|
|
x:Name="Description" />
|
|
|
|
|
<!-- Close Button -->
|
|
|
|
|
<Button
|
|
|
|
|
Grid.Column="2"
|
2025-08-12 23:08:54 +08:00
|
|
|
Style="{StaticResource AlertCloseButton}"
|
2025-07-31 20:12:01 +08:00
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
x:Name="PART_Close" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Grid>
|
2025-08-12 23:08:54 +08:00
|
|
|
</Border>
|
2025-07-11 09:20:23 +08:00
|
|
|
<ControlTemplate.Triggers>
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- With Description -->
|
2025-08-20 12:10:13 +08:00
|
|
|
<DataTrigger Binding="{Binding Description, Mode=OneWay, RelativeSource={RelativeSource Self}, Converter={x:Static conv:NullOrEmptyConverter.Instance}}" Value="False">
|
2025-08-12 23:08:54 +08:00
|
|
|
<!--<Setter TargetName="Icon" Property="FontSize" Value="14" />-->
|
|
|
|
|
<!--<Setter Property="Theme" TargetName="Icon" Value="Outlined" />-->
|
2025-07-31 20:12:01 +08:00
|
|
|
<Setter Property="Margin" TargetName="Message" Value="0,0,0,4" />
|
|
|
|
|
<Setter Property="Visibility" TargetName="Description" Value="Visible" />
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="FontSize" TargetName="PART_Close" Value="14" />
|
|
|
|
|
<Setter Property="TextElement.FontSize" TargetName="Message" Value="16" />
|
|
|
|
|
<Setter Property="TextElement.Foreground" TargetName="Message" Value="{DynamicResource TextPrimaryBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</DataTrigger>
|
2025-08-12 23:08:54 +08:00
|
|
|
<Trigger Property="Type" Value="Info">
|
|
|
|
|
<Setter Property="Data" TargetName="IconPath" Value="{DynamicResource info-circle}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Type" Value="Success">
|
|
|
|
|
<Setter Property="Data" TargetName="IconPath" Value="{DynamicResource check-circle}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Type" Value="Warning">
|
|
|
|
|
<Setter Property="Data" TargetName="IconPath" Value="{DynamicResource exclamation-circle}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Type" Value="Error">
|
|
|
|
|
<Setter Property="Data" TargetName="IconPath" Value="{DynamicResource close-circle}" />
|
|
|
|
|
</Trigger>
|
2025-07-11 09:20:23 +08:00
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="Type" Value="Info">
|
2025-08-12 23:08:54 +08:00
|
|
|
<!--<Setter Property="Icon" Value="info-circle" />-->
|
|
|
|
|
<Setter Property="IconBrush" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
|
|
|
<Setter Property="Background" Value="{DynamicResource PrimaryLightShadowBrush}" />
|
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryDisabledBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Type" Value="Success">
|
2025-08-12 23:08:54 +08:00
|
|
|
<!--<Setter Property="Icon" Value="check-circle" />-->
|
|
|
|
|
<Setter Property="IconBrush" Value="{DynamicResource SuccessBrush}" />
|
|
|
|
|
<Setter Property="Background" Value="{DynamicResource SuccessLightShadowBrush}" />
|
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource SuccessDisabledBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Type" Value="Warning">
|
2025-08-12 23:08:54 +08:00
|
|
|
<!--<Setter Property="Icon" Value="exclamation-circle" />-->
|
|
|
|
|
<Setter Property="IconBrush" Value="{DynamicResource WarningBrush}" />
|
|
|
|
|
<Setter Property="Background" Value="{DynamicResource WarningLightShadowBrush}" />
|
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource WarningDisabledBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Type" Value="Error">
|
2025-08-12 23:08:54 +08:00
|
|
|
<!--<Setter Property="Icon" Value="close-circle" />-->
|
|
|
|
|
<Setter Property="IconBrush" Value="{DynamicResource ErrorBrush}" />
|
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ErrorLightShadowBrush}" />
|
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ErrorDisabledBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Banner" Value="True">
|
|
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="assists:ControlAssist.CornerRadius" Value="0" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
2025-07-11 09:20:23 +08:00
|
|
|
</ResourceDictionary>
|