UIHelper.cs
 1  // Copyright (c) Microsoft Corporation
 2  // The Microsoft Corporation licenses this file to you under the MIT license.
 3  // See the LICENSE file in the project root for more information.
 4  
 5  using System;
 6  using System.Collections.Generic;
 7  using System.Linq;
 8  using System.Text;
 9  using System.Threading.Tasks;
10  using Microsoft.UI.Xaml;
11  using Microsoft.UI.Xaml.Automation.Peers;
12  
13  namespace Microsoft.CmdPal.UI.Helpers;
14  
15  public static partial class UIHelper
16  {
17      static UIHelper()
18      {
19      }
20  
21      public static void AnnounceActionForAccessibility(UIElement ue, string announcement, string activityID)
22      {
23          if (FrameworkElementAutomationPeer.FromElement(ue) is AutomationPeer peer)
24          {
25              peer.RaiseNotificationEvent(
26                  AutomationNotificationKind.ActionCompleted,
27                  AutomationNotificationProcessing.ImportantMostRecent,
28                  announcement,
29                  activityID);
30          }
31      }
32  }