Skip to content

Commit

Permalink
[FancyZones] Focus layout type instead of activating it on enter press (
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyoyuppe committed Aug 23, 2021
1 parent ea25bd9 commit cea9b35
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ public MainWindow(bool spanZonesAcrossMonitors, Rect workArea)

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;
Expand Down

0 comments on commit cea9b35

Please sign in to comment.