Browse Source

improve button click fixes #2148

Andrey Kunchev 7 years ago
parent
commit
a803e8bd7b
1 changed files with 1 additions and 3 deletions
  1. 1 3
      src/Avalonia.Controls/Button.cs

+ 1 - 3
src/Avalonia.Controls/Button.cs

@@ -253,10 +253,8 @@ namespace Avalonia.Controls
                 IsPressed = false;
                 e.Handled = true;
 
-                var hittest = this.GetVisualsAt(e.GetPosition(this));
-
                 if (ClickMode == ClickMode.Release &&
-                    hittest.Any(c => c == this || (c as IStyledElement)?.TemplatedParent == this))
+                    this.GetVisualsAt(e.GetPosition(this)).Any(c => this == c || this.IsVisualAncestorOf(c)))
                 {
                     OnClick();
                 }