[FancyZones] Focus layout type instead of activating it on enter press (#12823)

This commit is contained in:
Andrey Nekrasov 2021-08-23 14:29:00 +03:00 committed by GitHub
parent ea25bd91b0
commit cea9b35319
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,6 +42,20 @@ namespace FancyZonesEditor
KeyUp += MainWindow_KeyUp;
// Prevent closing the dialog with enter
PreviewKeyDown += (object sender, KeyEventArgs e) =>
{
if (e.Key == Key.Enter && _openedDialog != null && _openedDialog.IsVisible)
{
var source = e.OriginalSource as RadioButton;
if (source != null && source.IsChecked != true)
{
source.IsChecked = true;
e.Handled = true;
}
}
};
if (spanZonesAcrossMonitors)
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;