Exemplo n.º 1
0
        /// <summary>
        /// Helper for setting AccessibilityView property on a StyledElement.
        /// </summary>
        public static void SetAccessibilityView(StyledElement element, AccessibilityView value)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            element.SetValue(AccessibilityViewProperty, value);
        }
        /// <summary>
        /// Recursively sets AccessibilityView to <paramref name="accessibilityView"/> for <paramref name="parentPeer"/> children.
        /// </summary>
        /// <param name="parentPeer"></param>
        /// <param name="accessibilityView"></param>
        private static void SetChildrenAccessibilityView(AutomationPeer parentPeer, AccessibilityView accessibilityView)
        {
            if (parentPeer?.GetChildren() == null)
            {
                return;
            }

            foreach (AutomationPeer childPeer in parentPeer.GetChildren())
            {
                UIElement child = GetUIElementFromAutomationPeer(childPeer);
                if (child != null)
                {
                    AutomationProperties.SetAccessibilityView(child, accessibilityView);
                }
                SetChildrenAccessibilityView(childPeer, accessibilityView);
            }
        }
        /// <summary>
        /// Recursively sets AccessibilityView to <paramref name="accessibilityView"/> for <paramref name="parentPeer"/> children.
        /// </summary>
        /// <param name="parentPeer"></param>
        /// <param name="accessibilityView"></param>
        private static void SetChildrenAccessibilityView(AutomationPeer parentPeer, AccessibilityView accessibilityView)
        {
            if (parentPeer?.GetChildren() == null)
            {
                return;
            }

            foreach (AutomationPeer childPeer in parentPeer.GetChildren())
            {
                UIElement child = GetUIElementFromAutomationPeer(childPeer);
                if (child != null)
                {
                    AutomationProperties.SetAccessibilityView(child, accessibilityView);
                    // If element is hidden clear the generated label if any.
                    if (IsInGenerativeStateAndHidden(child))
                    {
                        child.ClearValue(AutomationProperties.NameProperty);
                    }
                }
                SetChildrenAccessibilityView(childPeer, accessibilityView);
            }
        }
Exemplo n.º 4
0
 public static void SetAccessibilityeView(DependencyObject element, AccessibilityView value)
 {
     element.SetValue(AccessibilityViewProperty, value);
 }