Files
ShrlAlgoToolkit/NeuWPF/NeoUI/Controls/Notification/NotificationView.xaml
ShrlAlgo 955a01f564 整理
2025-08-20 12:10:35 +08:00

115 lines
5.4 KiB
XML

<Window
AllowsTransparency="True"
Background="Transparent"
Height="Auto"
ShowInTaskbar="False"
SizeToContent="Height"
Title="NotificationWindow"
Topmost="True"
Width="384"
WindowStyle="None"
mc:Ignorable="d"
x:Class="NeoUI.Controls.NotificationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:NeoUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<controls:Card
Background="{DynamicResource BackgroundLayoutBrush}"
BorderThickness="1"
CornerRadius="4"
Margin="8"
x:Name="RootBorder">
<!--<controls:Card.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="10" Color="#000000" Opacity="0.1"/>
</controls:Card.Effect>-->
<!--<controls:Alert Message="{Binding Title}" Description="{Binding Message}" Type="{Binding Type}"/>-->
<Grid Margin="16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Icon Section (CORRECTED) -->
<Path
Grid.Column="0"
Height="20"
Margin="0,0,16,0"
Name="IconPath"
Stretch="Uniform"
VerticalAlignment="Top"
Width="20">
<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="{DynamicResource SuccessBrush}" />
</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="{DynamicResource PrimaryNormalBrush}" />
</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="{DynamicResource WarningBrush}" />
</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="{DynamicResource ErrorBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
<!-- Content Section -->
<StackPanel Grid.Column="1">
<TextBlock
FontSize="16"
FontWeight="Bold"
Foreground="{DynamicResource TextPrimaryBrush}"
Margin="0,0,0,4"
Name="TitleTextBlock"
Text="{Binding Title}" />
<TextBlock
FontSize="14"
Foreground="{DynamicResource TextPrimaryBrush}"
Name="MessageTextBlock"
Text="{Binding Message}"
TextWrapping="Wrap" />
</StackPanel>
<!-- Close Button -->
<Button
Click="CloseButton_Click"
Cursor="Hand"
Grid.Column="2"
Margin="8,-4,-4,-4"
Name="CloseButton"
VerticalAlignment="Top">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent">
<Path
Data="M 0,0 L 8,8 M 8,0 L 0,8"
HorizontalAlignment="Center"
Stroke="#999999"
StrokeThickness="1.5"
VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</controls:Card>
</Grid>
</Window>