Example #1
0
 ///
 public static AutomationPeer FromElement(ContentElement element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     return(element.GetAutomationPeer());
 }
 /// 
 public static AutomationPeer FromElement(ContentElement element)
 { 
     if (element == null)
     {
         throw new ArgumentNullException("element");
     } 
     return element.GetAutomationPeer();
 } 
Example #3
0
        internal static bool InvalidateAutomationPeer(
            DependencyObject o,
            out UIElement e,
            out ContentElement ce,
            out UIElement3D e3d)
        {
            e   = null;
            ce  = null;
            e3d = null;

            AutomationPeer ap = null;

            e = o as UIElement;
            if (e != null)
            {
                if (e.HasAutomationPeer == true)
                {
                    ap = e.GetAutomationPeer();
                }
            }
            else
            {
                ce = o as ContentElement;
                if (ce != null)
                {
                    if (ce.HasAutomationPeer == true)
                    {
                        ap = ce.GetAutomationPeer();
                    }
                }
                else
                {
                    e3d = o as UIElement3D;
                    if (e3d != null)
                    {
                        if (e3d.HasAutomationPeer == true)
                        {
                            ap = e3d.GetAutomationPeer();
                        }
                    }
                }
            }

            if (ap != null)
            {
                ap.InvalidateAncestorsRecursive();

                // Check for parent being non-null while stopping as we don't want to stop in between due to peers not connected to AT
                // those peers sometimes gets created to serve for various patterns.
                // e.g: ScrollViewAutomationPeer for Scroll Pattern in case of ListBox.
                if (ap.GetParent() != null)
                {
                    return(false);
                }
            }

            return(true);
        }
 internal static void RaiseAutomationEvents()
 {
     if (InputElement.IsUIElement(InputManager.ListeningElement))
     {
         UIElement e = (UIElement)InputManager.ListeningElement;
         //Raise InputDiscarded automation event
         SynchronizedInputHelper.RaiseAutomationEvent(e.GetAutomationPeer());
     }
     else if (InputElement.IsContentElement(InputManager.ListeningElement))
     {
         ContentElement ce = (ContentElement)InputManager.ListeningElement;
         //Raise InputDiscarded automation event
         SynchronizedInputHelper.RaiseAutomationEvent(ce.GetAutomationPeer());
     }
     else if (InputElement.IsUIElement3D(InputManager.ListeningElement))
     {
         UIElement3D e3D = (UIElement3D)InputManager.ListeningElement;
         //Raise InputDiscarded automation event
         SynchronizedInputHelper.RaiseAutomationEvent(e3D.GetAutomationPeer());
     }
 }