diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index 6c35e529..43184816 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -156,6 +156,7 @@ function Invoke-WPFUIElements { $checkBox.Name = $entryInfo.Name $checkBox.HorizontalAlignment = "Right" $checkBox.UseLayoutRounding = $true + [System.Windows.Automation.AutomationProperties]::SetName($checkBox, $entryInfo.Content) $dockPanel.Children.Add($checkBox) | Out-Null $checkBox.Style = $ColorfulToggleSwitchStyle @@ -191,6 +192,7 @@ function Invoke-WPFUIElements { $toggleButton.ToolTip = $entryInfo.Description $toggleButton.HorizontalAlignment = "Left" $toggleButton.Style = $ToggleButtonStyle + [System.Windows.Automation.AutomationProperties]::SetName($toggleButton, $entryInfo.Content[0]) $toggleButton.Tag = @{ contentOn = if ($entryInfo.Content.Count -ge 1) { $entryInfo.Content[0] } else { "" } @@ -232,6 +234,7 @@ function Invoke-WPFUIElements { $comboBox.SetResourceReference([Windows.Controls.Control]::MarginProperty, "ButtonMargin") $comboBox.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") $comboBox.UseLayoutRounding = $true + [System.Windows.Automation.AutomationProperties]::SetName($comboBox, $entryInfo.Content) foreach ($comboitem in ($entryInfo.ComboItems -split " ")) { $comboBoxItem = New-Object Windows.Controls.ComboBoxItem @@ -273,6 +276,7 @@ function Invoke-WPFUIElements { $baseWidth = [int]$entryInfo.ButtonWidth $button.Width = [math]::Max($baseWidth, 350) } + [System.Windows.Automation.AutomationProperties]::SetName($button, $entryInfo.Content) $itemsControl.Items.Add($button) | Out-Null $sync[$entryInfo.Name] = $button @@ -303,6 +307,7 @@ function Invoke-WPFUIElements { $radioButton.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") $radioButton.ToolTip = $entryInfo.Description $radioButton.UseLayoutRounding = $true + [System.Windows.Automation.AutomationProperties]::SetName($radioButton, $entryInfo.Content) if ($entryInfo.Checked -eq $true) { $radioButton.IsChecked = $true @@ -324,6 +329,7 @@ function Invoke-WPFUIElements { $checkBox.ToolTip = $entryInfo.Description $checkBox.SetResourceReference([Windows.Controls.Control]::MarginProperty, "CheckBoxMargin") $checkBox.UseLayoutRounding = $true + [System.Windows.Automation.AutomationProperties]::SetName($checkBox, $entryInfo.Content) if ($entryInfo.Checked -eq $true) { $checkBox.IsChecked = $entryInfo.Checked }