From 4d30de7c09b3b39efaf7a2c622a84bb4df56af89 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 5 Jun 2017 20:30:07 +0200 Subject: [PATCH] Only click when pointer is over the button. Previously a button click was carried out when `:pointerover` was set, but because the button captures mouse input on mouse down, this is always true while the mouse is held. Check that the pointer was released within the bounds of the control. Fixes #938 --- src/Avalonia.Controls/Button.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Button.cs b/src/Avalonia.Controls/Button.cs index 7ed1c7fd8c..2b3bbc8ad2 100644 --- a/src/Avalonia.Controls/Button.cs +++ b/src/Avalonia.Controls/Button.cs @@ -234,7 +234,7 @@ namespace Avalonia.Controls PseudoClasses.Remove(":pressed"); e.Handled = true; - if (ClickMode == ClickMode.Release && Classes.Contains(":pointerover")) + if (ClickMode == ClickMode.Release && new Rect(Bounds.Size).Contains(e.GetPosition(this))) { RaiseClickEvent(); }