From 0e64071051c6dc869379510d5570073f0bcc5391 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Tue, 20 Apr 2021 14:56:18 +0200 Subject: [PATCH] [FZ Editor] Edit dialog UX fixes (#10734) * Updates to UI * Handle enter key * Focus visual fix * Fix Co-authored-by: Niels Laute --- .../FancyZonesEditor/FancyZonesEditor.csproj | 2 +- .../editor/FancyZonesEditor/MainWindow.xaml | 331 +++++++++++------- .../FancyZonesEditor/MainWindow.xaml.cs | 9 + .../Properties/Resources.Designer.cs | 35 +- .../Properties/Resources.resx | 17 +- .../FancyZonesEditor/Styles/ButtonStyles.xaml | 2 +- 6 files changed, 259 insertions(+), 137 deletions(-) diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj index beabb659e0..c8aa6c63e4 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj +++ b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj @@ -65,7 +65,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml index 8636c438a2..5d1228ae74 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml +++ b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml @@ -2,16 +2,16 @@ x:Name="MainWindow1" AutomationProperties.Name="{x:Static props:Resources.Fancy_Zones_Main_Editor}" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:ui="http://schemas.modernwpf.com/2019" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:FancyZonesEditor" xmlns:Converters="clr-namespace:FancyZonesEditor.Converters" xmlns:props="clr-namespace:FancyZonesEditor.Properties" xmlns:local1="clr-namespace:FancyZonesEditor.ViewModels" - xmlns:ui="http://schemas.modernwpf.com/2019" - xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:controls="clr-namespace:ModernWpf.Controls;assembly=ModernWpf" + xmlns:sys="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" Title="FancyZones Editor" ui:WindowHelper.UseModernWindowStyle="True" @@ -84,18 +84,17 @@ - - - - + + + + + - + @@ -232,6 +234,7 @@ + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + VerticalAlignment="Center" + Height="36" + Width="36" + Padding="0" + BorderBrush="Transparent" + Click="EditZones_Click" + Visibility="{Binding Path=Type, Converter={StaticResource LayoutTypeCustomToVisibilityConverter}}" + ToolTip="{x:Static props:Resources.Edit_zones}" + AutomationProperties.Name="{x:Static props:Resources.Edit_zones}" + Style="{StaticResource AccentButtonStyle}" + ui:ControlHelper.CornerRadius="36"> + - + - - - - - - + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs index dbff7e317d..8707ec2de3 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs @@ -421,5 +421,14 @@ namespace FancyZonesEditor { _openedDialog = null; } + + private void EditDialogNumberBox_KeyDown(object sender, KeyEventArgs e) + { + // Making sure that pressing Enter when changing values in a NumberBox will not close the edit dialog. + if (e.Key == Key.Enter) + { + e.Handled = true; + } + } } } diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.Designer.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.Designer.cs index b0ed1cb6a0..4b22245ef7 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.Designer.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.Designer.cs @@ -250,7 +250,7 @@ namespace FancyZonesEditor.Properties { } /// - /// Looks up a localized string similar to Distance to highlight adjacent zones. + /// Looks up a localized string similar to Highlight distance. /// public static string Distance_adjacent_zones { get { @@ -537,6 +537,15 @@ namespace FancyZonesEditor.Properties { } } + /// + /// Looks up a localized string similar to Number of zones. + /// + public static string Number_of_zones { + get { + return ResourceManager.GetString("Number_of_zones", resourceCulture); + } + } + /// /// Looks up a localized string similar to Number of zones. /// @@ -546,6 +555,15 @@ namespace FancyZonesEditor.Properties { } } + /// + /// Looks up a localized string similar to px. + /// + public static string Pixels { + get { + return ResourceManager.GetString("Pixels", resourceCulture); + } + } + /// /// Looks up a localized string similar to None. /// @@ -556,11 +574,20 @@ namespace FancyZonesEditor.Properties { } /// - /// Looks up a localized string similar to Select a key to quickly apply the layout (Win + Ctrl + Alt + key). + /// Looks up a localized string similar to Press Win + Ctrl + Alt + selected key to apply this layout. /// - public static string QuickKey_Select { + public static string QuickKey_Description { get { - return ResourceManager.GetString("QuickKey_Select", resourceCulture); + return ResourceManager.GetString("QuickKey_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Layout shortcut. + /// + public static string QuickKey_Title { + get { + return ResourceManager.GetString("QuickKey_Title", resourceCulture); } } diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.resx b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.resx index 58809d5097..d53e745267 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.resx +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.resx @@ -145,7 +145,8 @@ Custom layout creator - Distance to highlight adjacent zones + Highlight distance + Distance of when an adjacent zone should light up when the window is close to it Edit layout @@ -343,10 +344,20 @@ Splitter: Title for concept: A segmenter visual for splitting one item into two. This would be the vertical line - - Select a key to quickly apply the layout (Win + Ctrl + Alt + key) + + Press Win + Ctrl + Alt + selected key to apply this layout None + + Number of zones + + + px + Abbreviation of pixels + + + Layout shortcut + \ No newline at end of file diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Styles/ButtonStyles.xaml b/src/modules/fancyzones/editor/FancyZonesEditor/Styles/ButtonStyles.xaml index c6cac96dbc..45b606d91e 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Styles/ButtonStyles.xaml +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Styles/ButtonStyles.xaml @@ -16,7 +16,7 @@ - +