1using System.Windows.Input;
17 TapGestureRecognizer TapRecognizer =
new();
18 TapRecognizer.Tapped += this.OnTapped;
19 this.GestureRecognizers.Add(TapRecognizer);
22 readonly WeakEventManager onClickedEventManager =
new();
27 public static readonly BindableProperty
CommandProperty = ButtonElement.CommandProperty;
56 void ICommandElement.CanExecuteChanged(
object? sender, EventArgs e) => this.RefreshIsEnabledProperty();
58 void IButtonElement.PropagateUpClicked() => this.onClickedEventManager.HandleEvent(
this, EventArgs.Empty, nameof(
Clicked));
60 protected override bool IsEnabledCore => base.IsEnabledCore && CommandElement.GetCanExecute(
this);
67 add => this.onClickedEventManager.AddEventHandler(value);
68 remove => this.onClickedEventManager.RemoveEventHandler(value);
71 private void OnTapped(
object? Sender, EventArgs e)
73 this.Animate(
"Blink",
new Animation()
75 { 0, 0.5,
new((value) => this.Scale = value, 1, 0.95, Easing.CubicOut) },
76 { 0.5, 1,
new((value) => this.Scale = value, 0.95, 1, Easing.CubicOut) },
79 ButtonElement.ElementClicked(
this,
this);