feat: Notification size.

This commit is contained in:
Zhang Dian
2024-09-11 14:25:37 +08:00
parent 01c2133012
commit 88f6bb138b
5 changed files with 20 additions and 11 deletions

View File

@@ -5,10 +5,17 @@
<ThemeVariantScope RequestedThemeVariant="Dark">
<StackPanel Orientation="Vertical">
<u:NotificationCard ShowClose="False" />
<u:NotificationCard>
<u:NotificationCard />
<u:NotificationCard NotificationType="Information">
Hello, Ursa!
</u:NotificationCard>
<u:NotificationCard NotificationType="Success">
<u:Notification Title="Welcome" />
</u:NotificationCard>
<u:NotificationCard NotificationType="Warning">
<u:Notification Content="Hello, Ursa!" />
</u:NotificationCard>
<u:NotificationCard NotificationType="Error">
<u:Notification Title="Welcome" Content="Hello, Ursa!" />
</u:NotificationCard>
</StackPanel>
@@ -61,9 +68,7 @@
<ControlTheme x:Key="{x:Type u:NotificationCard}" TargetType="u:NotificationCard">
<Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="MinWidth" Value="{DynamicResource NotificationCardMinWidth}" />
<Setter Property="BorderThickness" Value="{DynamicResource NotificationCardBorderThickness}" />
<Setter Property="BorderBrush" Value="{DynamicResource NotificationCardBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource NotificationCardBackground}" />
<Setter Property="CornerRadius" Value="{DynamicResource NotificationCardCornerRadius}" />
<Setter Property="Template">
@@ -76,14 +81,13 @@
<Border
x:Name="PART_RootBorder"
Padding="{DynamicResource NotificationCardPadding}"
BoxShadow="{DynamicResource NotificationCardBoxShadow}"
BoxShadow="{DynamicResource NotificationCardBoxShadows}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="Auto,*,Auto">
<DockPanel MinWidth="{DynamicResource NotificationCardMinWidth}">
<PathIcon
x:Name="NotificationIcon"
Grid.Column="0"
Width="{DynamicResource NotificationCardIconWidth}"
Height="{DynamicResource NotificationCardIconHeight}"
Margin="{DynamicResource NotificationCardIconMargin}"
@@ -92,7 +96,6 @@
Data="{DynamicResource NotificationCardInformationIconPathData}" />
<ContentControl
x:Name="PART_Content"
Grid.Column="1"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}">
<ContentControl.DataTemplates>
@@ -108,6 +111,7 @@
Foreground="{DynamicResource NotificationCardMessageForeground}"
FontSize="{DynamicResource NotificationCardMessageFontSize}"
FontWeight="{DynamicResource NotificationCardMessageFontWeight}"
IsVisible="{Binding Content, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Text="{Binding Content}"
TextWrapping="Wrap" />
</StackPanel>
@@ -124,13 +128,12 @@
</ContentControl>
<Button
x:Name="PART_CloseButton"
Grid.Column="2"
VerticalAlignment="Top"
HorizontalAlignment="Right"
Theme="{StaticResource NotificationCloseButton}"
IsVisible="{TemplateBinding ShowClose}"
u:MessageCard.CloseOnClick="True" />
</Grid>
</DockPanel>
</Border>
</Border>
</LayoutTransformControl>
@@ -409,6 +412,7 @@
<Setter Property="Height" Value="24" />
<Setter Property="Width" Value="24" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground" Value="{DynamicResource SemiColorText1}" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<Border