Example #1
0
        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);
            }
        }
Example #2
0
        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);
        }