mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 11:17:53 +01:00
FZE: Fix dialog number box input automation name (#12718)
This commit is contained in:
@@ -480,6 +480,7 @@
|
||||
KeyDown="EditDialogNumberBox_KeyDown"
|
||||
Margin="12,0,0,0"
|
||||
Header="{x:Static props:Resources.Number_of_zones}"
|
||||
Loaded="NumberBox_Loaded"
|
||||
AutomationProperties.Name="{x:Static props:Resources.Number_of_zones}"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Text="{Binding TemplateZoneCount}" />
|
||||
@@ -508,6 +509,7 @@
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Loaded="NumberBox_Loaded"
|
||||
AutomationProperties.Name="{x:Static props:Resources.Space_Around_Zones}"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=spacingTitle}" />
|
||||
<TextBlock Text="{x:Static props:Resources.Pixels}"
|
||||
@@ -554,6 +556,7 @@
|
||||
Maximum="1000"
|
||||
KeyDown="EditDialogNumberBox_KeyDown"
|
||||
Margin="12,0,0,0"
|
||||
Loaded="NumberBox_Loaded"
|
||||
AutomationProperties.Name="{x:Static props:Resources.Distance_adjacent_zones}"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=distanceTitle}"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
|
||||
@@ -491,5 +491,15 @@ namespace FancyZonesEditor
|
||||
_backup = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void NumberBox_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// The TextBox inside a NumberBox doesn't inherit the Automation Properties name, so we have to set it.
|
||||
var numberBox = sender as NumberBox;
|
||||
const string numberBoxTextBoxName = "InputBox"; // Text box template part name given by ModernWPF.
|
||||
numberBox.ApplyTemplate(); // Apply template to be able to change child's property.
|
||||
var numberBoxTextBox = numberBox.Template.FindName(numberBoxTextBoxName, numberBox) as TextBox;
|
||||
numberBoxTextBox.SetValue(AutomationProperties.NameProperty, numberBox.GetValue(AutomationProperties.NameProperty));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user