From 42dd06cf966981f32c36c13623267a125b475b94 Mon Sep 17 00:00:00 2001 From: Tridy Date: Thu, 29 Aug 2019 13:28:05 +0200 Subject: [PATCH 01/11] added IsCancel to Button Like pressing Enter triggers a button that has the property IsDefault set to true, pressing Escape should work on the button that has IsCancel set to true. --- src/Avalonia.Controls/Button.cs | 83 +++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Controls/Button.cs b/src/Avalonia.Controls/Button.cs index b09d3bddff..e7407201c4 100644 --- a/src/Avalonia.Controls/Button.cs +++ b/src/Avalonia.Controls/Button.cs @@ -64,6 +64,12 @@ namespace Avalonia.Controls public static readonly StyledProperty IsDefaultProperty = AvaloniaProperty.Register(nameof(IsDefault)); + /// + /// Defines the property. + /// + public static readonly StyledProperty IsCancelProperty = + AvaloniaProperty.Register(nameof(IsCancel)); + /// /// Defines the event. /// @@ -84,6 +90,7 @@ namespace Avalonia.Controls FocusableProperty.OverrideDefaultValue(typeof(Button), true); CommandProperty.Changed.Subscribe(CommandChanged); IsDefaultProperty.Changed.Subscribe(IsDefaultChanged); + IsCancelProperty.Changed.Subscribe(IsCancelChanged); PseudoClass