/// <summary> /// Makes screen reader announce the element if <see cref="AutomationProperties.LiveSettingProperty"/> /// is not <see cref="AutomationLiveSetting.Off"/> and <see cref="AutomationProperties.NameProperty"/> /// is not null or empty, by rising the <see cref="AutomationEvents.LiveRegionChanged"/> event. /// </summary> /// <param name="element"></param> public static void AnnounceIfNeeded(UIElement element) { if (AutomationProperties.GetLiveSetting(element) != AutomationLiveSetting.Off && !string.IsNullOrEmpty(AutomationProperties.GetName(element))) { var peer = FrameworkElementAutomationPeer.FromElement(element); peer?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged); } }
/// <summary> /// <see cref="AutomationPeer.GetLiveSettingCore"/> /// </summary> override protected AutomationLiveSetting GetLiveSettingCore() { return(AutomationProperties.GetLiveSetting(_owner)); }