Browse Source

Merge pull request #6991 from ltetak/osx_sound_defaultactions

[OSX] Handle default dialog actions to prevent beeping sounds
pull/7859/head
Max Katz 4 years ago
committed by GitHub
parent
commit
9fcc233765
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      samples/ControlCatalog/Pages/DialogsPage.xaml.cs
  2. 2
      src/Avalonia.Controls/Button.cs

3
samples/ControlCatalog/Pages/DialogsPage.xaml.cs

@ -157,7 +157,8 @@ namespace ControlCatalog.Pages
(button = new Button
{
HorizontalAlignment = HorizontalAlignment.Center,
Content = "Click to close"
Content = "Click to close",
IsDefault = true
})
}
},

2
src/Avalonia.Controls/Button.cs

@ -539,6 +539,7 @@ namespace Avalonia.Controls
if (e.Key == Key.Enter && IsVisible && IsEnabled)
{
OnClick();
e.Handled = true;
}
}
@ -552,6 +553,7 @@ namespace Avalonia.Controls
if (e.Key == Key.Escape && IsVisible && IsEnabled)
{
OnClick();
e.Handled = true;
}
}

Loading…
Cancel
Save