Exemplo n.º 1
0
        // Return proxy representing element in specified direction (parent/next/firstchild/etc.)
        private object InContextNavigate(object arg)
        {
            NavigateDirection direction = (NavigateDirection)arg;
            AutomationPeer    dest;
            AutomationPeer    peer = Peer;

            if (peer == null)
            {
                return(null);
            }

            switch (direction)
            {
            case NavigateDirection.Parent:
                dest = peer.GetParent();
                break;

            case NavigateDirection.FirstChild:
                if (!peer.IsInteropPeer)
                {
                    dest = peer.GetFirstChild();
                }
                else
                {
                    return(peer.GetInteropChild());
                }
                break;

            case NavigateDirection.LastChild:
                if (!peer.IsInteropPeer)
                {
                    dest = peer.GetLastChild();
                }
                else
                {
                    return(peer.GetInteropChild());
                }
                break;

            case NavigateDirection.NextSibling:
                dest = peer.GetNextSibling();
                break;

            case NavigateDirection.PreviousSibling:
                dest = peer.GetPreviousSibling();
                break;

            default:
                dest = null;
                break;
            }

            return(StaticWrap(dest, peer));
        }
Exemplo n.º 2
0
        private IntPtr OnWmGetObject(IntPtr wparam, IntPtr lparam)
        {
            IntPtr         result         = IntPtr.Zero;
            AutomationPeer automationPeer = UIElementAutomationPeer.CreatePeerForElement(this);

            if (automationPeer != null)
            {
                IRawElementProviderSimple interopChild = automationPeer.GetInteropChild();
                result = AutomationInteropProvider.ReturnRawElementProvider(this.CriticalHandle, wparam, lparam, interopChild);
            }
            return(result);
        }
Exemplo n.º 3
0
        private IntPtr OnWmGetObject(IntPtr wparam, IntPtr lparam)
        {
            IntPtr result = IntPtr.Zero;

            AutomationPeer containerPeer = UIElementAutomationPeer.CreatePeerForElement(this);

            if (containerPeer != null)
            {
                // get the element proxy
                IRawElementProviderSimple el = containerPeer.GetInteropChild();
                result = AutomationInteropProvider.ReturnRawElementProvider(CriticalHandle, wparam, lparam, el);
            }
            return(result);
        }