Files
ShrlAlgoToolkit/AntDesignWPF/Controls/Notification/NotificationView.xaml
2025-07-31 20:12:24 +08:00

80 lines
4.6 KiB
XML

<Window x:Class="AntDesignWPF.Controls.NotificationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Width="384"
Height="Auto"
mc:Ignorable="d"
AllowsTransparency="True"
Background="Transparent"
Loaded="Window_Loaded"
ShowInTaskbar="False"
SizeToContent="Height"
Title="NotificationWindow"
Topmost="True"
WindowStyle="None">
<Grid>
<Border Name="RootBorder" Margin="8" Background="{DynamicResource AntDesign.Brush.BackgroundContainer}" CornerRadius="4" BorderThickness="1">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="10" Color="#000000" Opacity="0.1"/>
</Border.Effect>
<Grid Margin="16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon Section (CORRECTED) -->
<Path Name="IconPath" Grid.Column="0" Stretch="Uniform" Width="20" Height="20" Margin="0,0,16,0" VerticalAlignment="Top">
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<!-- Success -->
<DataTrigger Binding="{Binding Type}" Value="Success">
<Setter Property="Data" Value="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
<Setter Property="Fill" Value="{StaticResource AntDesign.Brush.Success}"/>
</DataTrigger>
<!-- Info -->
<DataTrigger Binding="{Binding Type}" Value="Info">
<Setter Property="Data" Value="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
<Setter Property="Fill" Value="{StaticResource AntDesign.Brush.Info}"/>
</DataTrigger>
<!-- Warning -->
<DataTrigger Binding="{Binding Type}" Value="Warning">
<Setter Property="Data" Value="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>
<Setter Property="Fill" Value="{StaticResource AntDesign.Brush.Warning}"/>
</DataTrigger>
<!-- Error -->
<DataTrigger Binding="{Binding Type}" Value="Error">
<Setter Property="Data" Value="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
<Setter Property="Fill" Value="{StaticResource AntDesign.Brush.Error}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
<!-- Content Section -->
<StackPanel Grid.Column="1">
<TextBlock Name="TitleTextBlock" Text="{Binding Title}" FontWeight="Bold" FontSize="16" Foreground="{DynamicResource AntDesign.Brush.TextPrimary}" Margin="0,0,0,4"/>
<TextBlock Name="MessageTextBlock" Text="{Binding Message}" Foreground="{DynamicResource AntDesign.Brush.TextSecondary}" TextWrapping="Wrap" FontSize="14"/>
</StackPanel>
<!-- Close Button -->
<Button Grid.Column="2" Name="CloseButton" VerticalAlignment="Top" Margin="8,-4,-4,-4" Click="CloseButton_Click" Cursor="Hand">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent">
<Path Data="M 0,0 L 8,8 M 8,0 L 0,8" Stroke="#999999" StrokeThickness="1.5" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Border>
<!-- The <Grid.Style> block has been removed from here -->
</Grid>
</Window>