feat: add Light class to NotificationCard.
This commit is contained in:
parent
38b9494aaf
commit
a328e2bb99
@ -9,6 +9,7 @@
|
||||
mc:Ignorable="d">
|
||||
<StackPanel Spacing="20">
|
||||
<StackPanel>
|
||||
<Slider Name="SliderTest" Maximum="400" Minimum="0" TickFrequency="1" IsSnapToTickEnabled="True" />
|
||||
<Expander Header="Expander 1">
|
||||
<TextBlock Text="Hello Avalonia!" />
|
||||
</Expander>
|
||||
|
@ -7,18 +7,33 @@
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||
<StackPanel Spacing="20">
|
||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||
<Button Click="NormalButton_OnClick" Content="Information" />
|
||||
<Button Click="NormalButton_OnClick" Content="Success" Classes="Success" />
|
||||
<Button Click="NormalButton_OnClick" Content="Warning" Classes="Warning" />
|
||||
<Button Click="NormalButton_OnClick" Content="Error" Classes="Danger" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Click="PositionButton_OnClick" Content="TopLeft" />
|
||||
<Button Click="PositionButton_OnClick" Content="TopCenter" />
|
||||
<Button Click="PositionButton_OnClick" Content="TopRight" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Click="PositionButton_OnClick" Content="BottomLeft" />
|
||||
<Button Click="PositionButton_OnClick" Content="BottomCenter" />
|
||||
<Button Click="PositionButton_OnClick" Content="BottomRight" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="Button">
|
||||
<Setter Property="Theme" Value="{DynamicResource SolidButton}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
|
||||
<Button Click="InfoButton_OnClick" Content="Default" />
|
||||
<Button Click="InfoButton_OnClick" Content="Information" />
|
||||
<Button Click="InfoButton_OnClick" Content="Success" Classes="Success" />
|
||||
<Button Click="InfoButton_OnClick" Content="Warning" Classes="Warning" />
|
||||
<Button Click="InfoButton_OnClick" Content="Error" Classes="Danger" />
|
||||
<Button Click="LightButton_OnClick" Content="Information" />
|
||||
<Button Click="LightButton_OnClick" Content="Success" Classes="Success" />
|
||||
<Button Click="LightButton_OnClick" Content="Warning" Classes="Warning" />
|
||||
<Button Click="LightButton_OnClick" Content="Error" Classes="Danger" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</UserControl>
|
@ -22,13 +22,35 @@ public partial class NotificationDemo : UserControl
|
||||
_manager = new WindowNotificationManager(topLevel) { MaxItems = 3 };
|
||||
}
|
||||
|
||||
private void InfoButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
private void NormalButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button b && b.Content is string s)
|
||||
{
|
||||
_manager?.Show(Enum.TryParse<NotificationType>(s, out NotificationType t)
|
||||
_manager?.Show(Enum.TryParse<NotificationType>(s, out var t)
|
||||
? new Notification(t.ToString(), "This is message", t)
|
||||
: new Notification(s, "This is message"));
|
||||
}
|
||||
}
|
||||
|
||||
private void PositionButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button b && b.Content is string s)
|
||||
{
|
||||
Enum.TryParse<NotificationPosition>(s, out var t);
|
||||
_manager.Position = t;
|
||||
_manager?.Show(new Notification(t.ToString(), "This is message"));
|
||||
}
|
||||
}
|
||||
|
||||
private void LightButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button b && b.Content is string s)
|
||||
{
|
||||
Enum.TryParse<NotificationType>(s, out var notificationType);
|
||||
_manager?.Show(
|
||||
new Notification(notificationType.ToString(), "This is message"),
|
||||
type: notificationType,
|
||||
classes: ["Light"]);
|
||||
}
|
||||
}
|
||||
}
|
@ -33,9 +33,12 @@
|
||||
<LayoutTransformControl Name="PART_LayoutTransformControl" UseRenderTransform="True">
|
||||
<Border
|
||||
Margin="{DynamicResource NotificationCardMargin}"
|
||||
Padding="{DynamicResource NotificationCardPadding}"
|
||||
BoxShadow="{DynamicResource NotificationCardBoxShadows}"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Border
|
||||
x:Name="PART_RootBorder"
|
||||
Padding="{DynamicResource NotificationCardPadding}"
|
||||
BoxShadow="{DynamicResource NotificationCardBoxShadow}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
@ -80,6 +83,7 @@
|
||||
</ContentControl>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Border>
|
||||
</LayoutTransformControl>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
@ -163,5 +167,25 @@
|
||||
<Setter Property="Foreground" Value="{DynamicResource NotificationCardErrorIconForeground}" />
|
||||
<Setter Property="Data" Value="{DynamicResource NotificationCardErrorIconPathData}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Light">
|
||||
<Setter Property="Background" Value="{DynamicResource SemiColorBackground0}" />
|
||||
<Style Selector="^:information /template/ Border#PART_RootBorder">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource SemiColorInformation}" />
|
||||
<Setter Property="Background" Value="{DynamicResource SemiColorInformationLight}" />
|
||||
</Style>
|
||||
<Style Selector="^:success /template/ Border#PART_RootBorder">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource SemiColorSuccess}" />
|
||||
<Setter Property="Background" Value="{DynamicResource SemiColorSuccessLight}" />
|
||||
</Style>
|
||||
<Style Selector="^:warning /template/ Border#PART_RootBorder">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource SemiColorWarning}" />
|
||||
<Setter Property="Background" Value="{DynamicResource SemiColorWarningLight}" />
|
||||
</Style>
|
||||
<Style Selector="^:error /template/ Border#PART_RootBorder">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource SemiColorDanger}" />
|
||||
<Setter Property="Background" Value="{DynamicResource SemiColorDangerLight}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
Loading…
x
Reference in New Issue
Block a user