feat: add close button.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
<vm:ToastDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<StackPanel>
|
||||
<ToggleSwitch IsChecked="{Binding ShowClose}" Content="ShowClose"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||
<Button Command="{Binding ShowNormal}" CommandParameter="{Binding $self.Content}" Content="Information" />
|
||||
<Button Command="{Binding ShowNormal}" CommandParameter="{Binding $self.Content}" Content="Success" Classes="Success" />
|
||||
|
||||
@@ -10,6 +10,9 @@ public partial class ToastDemoViewModel : ObservableObject
|
||||
{
|
||||
public WindowToastManager? ToastManager { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _showClose = true;
|
||||
|
||||
[RelayCommand]
|
||||
public void ShowNormal(object obj)
|
||||
{
|
||||
@@ -18,6 +21,7 @@ public partial class ToastDemoViewModel : ObservableObject
|
||||
Enum.TryParse<NotificationType>(s, out var notificationType);
|
||||
ToastManager?.Show(
|
||||
new Toast("This is message"),
|
||||
showClose: ShowClose,
|
||||
type: notificationType);
|
||||
}
|
||||
|
||||
@@ -36,6 +40,7 @@ public partial class ToastDemoViewModel : ObservableObject
|
||||
Enum.TryParse<NotificationType>(s, out var notificationType);
|
||||
ToastManager?.Show(
|
||||
new Toast("This is message"),
|
||||
showClose: ShowClose,
|
||||
type: notificationType,
|
||||
classes: ["Light"]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user