feat: Notification size.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:ToastCard}" TargetType="u:ToastCard">
|
||||
<Setter Property="UseLayoutRounding" Value="True" />
|
||||
<Setter Property="RenderTransformOrigin" Value="50%,75%" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource NotificationCardBorderThickness}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource NotificationCardBorderBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource NotificationCardBackground}" />
|
||||
@@ -48,7 +47,7 @@
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
MinHeight="{DynamicResource ToastCardMinHeight}"
|
||||
Padding="{DynamicResource ToastCardPadding}"
|
||||
BoxShadow="{DynamicResource NotificationCardBoxShadow}"
|
||||
BoxShadow="{DynamicResource NotificationCardBoxShadows}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto">
|
||||
<PathIcon
|
||||
|
||||
3
src/Ursa.Themes.Semi/Themes/Shared/Notification.axaml
Normal file
3
src/Ursa.Themes.Semi/Themes/Shared/Notification.axaml
Normal file
@@ -0,0 +1,3 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Thickness x:Key="NotificationCardPadding">20 16 12 16</Thickness>
|
||||
</ResourceDictionary>
|
||||
@@ -14,6 +14,7 @@
|
||||
<MergeResourceInclude Source="KeyGestureInput.axaml" />
|
||||
<MergeResourceInclude Source="MessageBox.axaml" />
|
||||
<MergeResourceInclude Source="NavigationMenu.axaml" />
|
||||
<MergeResourceInclude Source="Notification.axaml" />
|
||||
<MergeResourceInclude Source="Pagination.axaml" />
|
||||
<MergeResourceInclude Source="Rating.axaml" />
|
||||
<MergeResourceInclude Source="ScrollToButton.axaml" />
|
||||
|
||||
@@ -110,6 +110,8 @@ public class WindowNotificationManager : WindowMessageManager, INotificationMana
|
||||
NotificationType = type,
|
||||
ShowClose = showClose
|
||||
};
|
||||
// this.Bind(PositionProperty,notificationControl.GetObservable(PositionProperty));
|
||||
this[!PositionProperty] = notificationControl[!NotificationCard.PositionProperty];
|
||||
|
||||
// Add style classes if any
|
||||
if (classes is not null)
|
||||
|
||||
Reference in New Issue
Block a user