功能完善
This commit is contained in:
115
NeuWPF/NeoUI/Controls/Notification/NotificationView.xaml
Normal file
115
NeuWPF/NeoUI/Controls/Notification/NotificationView.xaml
Normal file
@@ -0,0 +1,115 @@
|
||||
<Window
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
Height="Auto"
|
||||
ShowInTaskbar="False"
|
||||
SizeToContent="Height"
|
||||
Title="NotificationWindow"
|
||||
Topmost="True"
|
||||
Width="384"
|
||||
WindowStyle="None"
|
||||
mc:Ignorable="d"
|
||||
x:Class="NeumUI.Controls.NotificationView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:NeumUI.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>
|
||||
Reference in New Issue
Block a user