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