Announce automatically corrected HotKey (#12362)

This commit is contained in:
Stefan Markovic 2021-07-15 13:22:23 +02:00 committed by GitHub
parent 1bd702340b
commit 39f0db8cb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}