public static void SetAccessibleNameAndNotifyScreenReaderAutomationIfKeyboardFocused(AutomationPeer automationPeer, UIElement uiElement, string str, bool skipNotify) { uiElement.SetValue(AutomationProperties.NameProperty, str); if (!skipNotify) { //#if DEBUG // Debugger.Break(); //#endif //DEBUG TextBlockWithAutomationPeer.NotifyScreenReaderAutomationIfKeyboardFocused(automationPeer, uiElement); } }
protected override AutomationPeer OnCreateAutomationPeer() { m_AutomationPeer = base.OnCreateAutomationPeer(); DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty( AutomationProperties.NameProperty, typeof(ComboBoxWithAutomationPeer)); if (dpd != null) { m_AutomaticChangeNotificationForAutomationPropertiesName = true; dpd.AddValueChanged(this, new EventHandler((o, e) => { TextBlockWithAutomationPeer.NotifyScreenReaderAutomationIfKeyboardFocused(m_AutomationPeer, this); })); } return(m_AutomationPeer); }
public static void NotifyScreenReaderAutomationIfKeyboardFocused(AutomationPeer automationPeer, UIElement uiElement) { if (uiElement.IsKeyboardFocused) { var str = uiElement.GetValue(AutomationProperties.NameProperty) as String; #if DEBUG Console.WriteLine("AUTOMATION NAME ==> " + str); var str2 = AutomationProperties.GetName(uiElement); DebugFix.Assert(str2 == str); if (automationPeer != null) { string str3 = automationPeer.GetName(); DebugFix.Assert(str3 == str); } #endif //DEBUG TextBlockWithAutomationPeer.NotifyScreenReaderAutomation(automationPeer, str); } }
public void SetAccessibleNameAndNotifyScreenReaderAutomationIfKeyboardFocused(string str) { TextBlockWithAutomationPeer.SetAccessibleNameAndNotifyScreenReaderAutomationIfKeyboardFocused(m_AutomationPeer, this, str, m_AutomaticChangeNotificationForAutomationPropertiesName); }