Enable keyboard accessibility for template and custom layout items (#7977)

This commit is contained in:
vldmr11080
2020-11-10 16:24:20 +01:00
committed by GitHub
parent db61c6b643
commit 0a8bc1a63c
2 changed files with 28 additions and 2 deletions

View File

@@ -84,6 +84,21 @@ namespace FancyZonesEditor
Select(((Border)sender).DataContext as LayoutModel);
}
private void LayoutItem_Focused(object sender, RoutedEventArgs e)
{
Select(((Border)sender).DataContext as LayoutModel);
}
private void LayoutItem_Apply(object sender, KeyEventArgs e)
{
if (e.Key == Key.Return || e.Key == Key.Space)
{
// When certain layout item (template or custom) is focused through keyboard and user
// presses Enter or Space key, layout will be applied.
Apply();
}
}
private void Select(LayoutModel newSelection)
{
if (EditorOverlay.Current.DataContext is LayoutModel currentSelection)
@@ -154,6 +169,11 @@ namespace FancyZonesEditor
}
private void Apply_Click(object sender, RoutedEventArgs e)
{
Apply();
}
private void Apply()
{
EditorOverlay mainEditor = EditorOverlay.Current;