Browse Source

Merge pull request #10252 from AvaloniaUI/revert-10133-button_click

Revert "Only set pointer events to handled in button if click is triggered"
pull/10257/head
Max Katz 3 years ago
committed by GitHub
parent
commit
87af06092c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Avalonia.Controls/Button.cs

4
src/Avalonia.Controls/Button.cs

@ -394,10 +394,10 @@ namespace Avalonia.Controls
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
{
IsPressed = true;
e.Handled = true;
if (ClickMode == ClickMode.Press)
{
e.Handled = true;
OnClick();
}
}
@ -411,11 +411,11 @@ namespace Avalonia.Controls
if (IsPressed && e.InitialPressMouseButton == MouseButton.Left)
{
IsPressed = false;
e.Handled = true;
if (ClickMode == ClickMode.Release &&
this.GetVisualsAt(e.GetPosition(this)).Any(c => this == c || this.IsVisualAncestorOf(c)))
{
e.Handled = true;
OnClick();
}
}

Loading…
Cancel
Save