mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-04 03:49:07 +08:00
[FancyZones Editor][Accessibility] Default focused elements in all FancyZones Editor windows (#7971)
* Default focused elements * Fix focus when starting editor from settings
This commit is contained in:
parent
6a580c720a
commit
102f42928c
@ -176,7 +176,7 @@
|
||||
</Style>
|
||||
|
||||
</Window.Resources>
|
||||
<StackPanel>
|
||||
<StackPanel FocusManager.FocusedElement="{Binding ElementName=newZoneButton}">
|
||||
<TextBlock Name="windowEditorDialogTitle" Text="{x:Static props:Resources.Custom_Layout_Creator}" Style="{StaticResource titleText}" />
|
||||
<Button x:Name="newZoneButton" AutomationProperties.LabeledBy="{Binding ElementName=newZoneName}" Width="496" Height="136" Style="{StaticResource newZoneButton}" Click="OnAddZone">
|
||||
<StackPanel>
|
||||
|
@ -179,7 +179,7 @@
|
||||
|
||||
<TextBlock Text="{x:Static props:Resources.Note_Custom_Table}" Style="{StaticResource textLabel}" TextWrapping="Wrap" />
|
||||
<TextBlock x:Name="customLayoutName" Text="{x:Static props:Resources.Name}" Style="{StaticResource textLabel}" />
|
||||
<TextBox Text="{Binding Name}" AutomationProperties.LabeledBy="{Binding ElementName=customLayoutName}" Style="{StaticResource textBox}" />
|
||||
<TextBox Name="customLayoutNameTextBox" Text="{Binding Name}" GotFocus="NameTextBox_GotFocus" AutomationProperties.LabeledBy="{Binding ElementName=customLayoutName}" Style="{StaticResource textBox}" />
|
||||
<!--
|
||||
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
|
||||
<CheckBox x:Name="showGridSetting" VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="True" Margin="21,4,0,0"/>
|
||||
|
@ -38,5 +38,15 @@ namespace FancyZonesEditor
|
||||
}
|
||||
|
||||
private GridLayoutModel _stashedModel;
|
||||
|
||||
private void NameTextBox_GotFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
customLayoutNameTextBox.CaretIndex = customLayoutNameTextBox.Text.Length;
|
||||
}
|
||||
|
||||
public System.Windows.Controls.TextBox NameTextBox()
|
||||
{
|
||||
return customLayoutNameTextBox;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -187,8 +187,8 @@
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Window.Resources>
|
||||
|
||||
<StackPanel>
|
||||
|
||||
<StackPanel FocusManager.FocusedElement="{Binding ElementName=decrementZones}">
|
||||
|
||||
<TextBlock Name="DialogTitle" Text="{x:Static props:Resources.Choose_Layout}" Style="{StaticResource titleText}" />
|
||||
|
||||
|
@ -154,9 +154,11 @@ namespace FancyZonesEditor
|
||||
mainEditor.Edit();
|
||||
|
||||
EditorWindow window;
|
||||
bool isGrid = false;
|
||||
if (model is GridLayoutModel)
|
||||
{
|
||||
window = new GridEditorWindow();
|
||||
isGrid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -166,6 +168,10 @@ namespace FancyZonesEditor
|
||||
window.Owner = EditorOverlay.Current;
|
||||
window.DataContext = model;
|
||||
window.Show();
|
||||
if (isGrid)
|
||||
{
|
||||
(window as GridEditorWindow).NameTextBox().Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void Apply_Click(object sender, RoutedEventArgs e)
|
||||
|
@ -724,7 +724,7 @@ void FancyZones::ToggleEditor() noexcept
|
||||
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };
|
||||
sei.lpFile = NonLocalizable::FZEditorExecutablePath;
|
||||
sei.lpParameters = params.c_str();
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.nShow = SW_SHOWDEFAULT;
|
||||
ShellExecuteEx(&sei);
|
||||
Trace::FancyZones::EditorLaunched(1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user