Skip to content

Commit

Permalink
Double click to close editor (#11098)
Browse files Browse the repository at this point in the history
Co-authored-by: Niels Laute <niels9001@hotmail.com>
  • Loading branch information
niels9001 and Niels Laute committed May 4, 2021
1 parent 4ef667d commit 86e4a91
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
SelectionMode="Single"
IsSelectionEnabled="True"
ItemClick="Layout_ItemClick"
MouseDoubleClick="LayoutItem_MouseDoubleClick"
Margin="-8,8,-8,0">
<ui:GridView.ItemContainerStyle>
<Style BasedOn="{StaticResource LayoutItemContainerStyle}"
Expand Down Expand Up @@ -250,6 +251,7 @@
SelectionMode="Single"
IsItemClickEnabled="True"
ItemClick="Layout_ItemClick"
MouseDoubleClick="LayoutItem_MouseDoubleClick"
AutomationProperties.LabeledBy="{Binding ElementName=CustomHeaderBlock}"
Margin="-8,8,-8,0"
Grid.Row="4">
Expand Down
26 changes: 18 additions & 8 deletions src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,24 @@ private void MainWindow_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
if (_openedDialog != null)
{
_openedDialog.Hide();
}
else
{
OnClosing(sender, null);
}
CloseDialog(sender);
}
}

private void LayoutItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
CloseDialog(sender);
}

private void CloseDialog(object sender)
{
if (_openedDialog != null)
{
_openedDialog.Hide();
}
else
{
OnClosing(sender, null);
}
}

Expand Down

0 comments on commit 86e4a91

Please sign in to comment.