diff --git a/SukiUI.Demo/Features/ControlsLibrary/Toasts/ToastsView.axaml b/SukiUI.Demo/Features/ControlsLibrary/Toasts/ToastsView.axaml index 482c96801..f4a6acb07 100644 --- a/SukiUI.Demo/Features/ControlsLibrary/Toasts/ToastsView.axaml +++ b/SukiUI.Demo/Features/ControlsLibrary/Toasts/ToastsView.axaml @@ -78,6 +78,13 @@ Content="Show Toast" /> + + + + + + + + + + + + + + + + diff --git a/SukiUI/Controls/SukiToast.axaml.cs b/SukiUI/Controls/SukiToast.axaml.cs index 90b983767..bbea9b7bd 100644 --- a/SukiUI/Controls/SukiToast.axaml.cs +++ b/SukiUI/Controls/SukiToast.axaml.cs @@ -5,6 +5,7 @@ using SukiUI.Models; using System; using System.Timers; +using Avalonia.Interactivity; using Avalonia.Media; using SukiUI.Content; using SukiUI.Enums; @@ -20,6 +21,7 @@ public class SukiToast : ContentControl private readonly Timer _timer = new(); private Action? _onClickedCallback; + private Action? _onActionCallback; public SukiToast() { @@ -49,12 +51,36 @@ public string Title get => GetValue(TitleProperty); set => SetValue(TitleProperty, value); } + + public static readonly StyledProperty ShowActionButtonProperty = + AvaloniaProperty.Register(nameof(ShowActionButton)); + + public bool ShowActionButton + { + get => GetValue(ShowActionButtonProperty); + set => SetValue(ShowActionButtonProperty, value); + } + + public static readonly StyledProperty ActionButtonContentProperty = + AvaloniaProperty.Register(nameof(ActionButtonContent)); + + public string ActionButtonContent + { + get => GetValue(ActionButtonContentProperty); + set => SetValue(ActionButtonContentProperty, value); + } protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); e.NameScope.Get("PART_ToastCard").PointerPressed += ToastCardClickedHandler; + e.NameScope.Get