From 39f0db8cb4b2870b49110e468a7a9984db074e28 Mon Sep 17 00:00:00 2001 From: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Date: Thu, 15 Jul 2021 13:22:23 +0200 Subject: [PATCH] Announce automatically corrected HotKey (#12362) --- .../Controls/HotkeySettingsControl.xaml.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs index 3711bf03ca..c27ad5ccb6 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs @@ -7,6 +7,7 @@ using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; using Windows.UI.Core; using Windows.UI.Xaml; +using Windows.UI.Xaml.Automation.Peers; using Windows.UI.Xaml.Controls; namespace Microsoft.PowerToys.Settings.UI.Controls @@ -277,6 +278,22 @@ namespace Microsoft.PowerToys.Settings.UI.Controls } HotkeyTextBox.Text = hotkeySettings.ToString(); + if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged)) + { + TextBoxAutomationPeer peer = + FrameworkElementAutomationPeer.FromElement(HotkeyTextBox) as TextBoxAutomationPeer; + string textBoxChangeActivityId = "textBoxChangedOnLosingFocus"; + + if (peer != null) + { + peer.RaiseNotificationEvent( + AutomationNotificationKind.ActionCompleted, + AutomationNotificationProcessing.ImportantMostRecent, + HotkeyTextBox.Text, + textBoxChangeActivityId); + } + } + _isActive = false; }