// Token: 0x06005E7B RID: 24187 RVA: 0x001A7A80 File Offset: 0x001A5C80
        internal static bool IsDescendant(DependencyObject reference, DependencyObject node)
        {
            bool             result           = false;
            DependencyObject dependencyObject = node;

            while (dependencyObject != null)
            {
                if (dependencyObject == reference)
                {
                    result = true;
                    break;
                }
                PopupRoot popupRoot = dependencyObject as PopupRoot;
                if (popupRoot != null)
                {
                    Popup popup = popupRoot.Parent as Popup;
                    dependencyObject = popup;
                    if (popup != null)
                    {
                        dependencyObject = popup.Parent;
                        if (dependencyObject == null)
                        {
                            dependencyObject = popup.PlacementTarget;
                        }
                    }
                }
                else
                {
                    dependencyObject = PopupControlService.FindParent(dependencyObject);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        internal static bool IsDescendant(DependencyObject reference, DependencyObject node)
        {
            bool success = false;

            DependencyObject curr = node;

            while (curr != null)
            {
                if (curr == reference)
                {
                    success = true;
                    break;
                }

                // Find popup if curr is a PopupRoot
                PopupRoot popupRoot = curr as PopupRoot;
                if (popupRoot != null)
                {
                    //Now Popup does not have a visual link to its parent (for context menu)
                    //it is stored in its parent's arraylist (DP)
                    //so we get its parent by looking at PlacementTarget
                    Popup popup = popupRoot.Parent as Popup;

                    curr = popup;

                    if (popup != null)
                    {
                        // Try the poup Parent
                        curr = popup.Parent;

                        // Otherwise fall back to placement target
                        if (curr == null)
                        {
                            curr = popup.PlacementTarget;
                        }
                    }
                }
                else // Otherwise walk tree
                {
                    curr = PopupControlService.FindParent(curr);
                }
            }

            return(success);
        }
Ejemplo n.º 3
0
 ///
 public PopupRootAutomationPeer(PopupRoot owner): base(owner)
 {}
Ejemplo n.º 4
0
 internal void ForceMsaaToUiaBridge(PopupRoot popupRoot)
 {
     if (Handle != IntPtr.Zero && (UnsafeNativeMethods.IsWinEventHookInstalled(NativeMethods.EVENT_OBJECT_FOCUS) || UnsafeNativeMethods.IsWinEventHookInstalled(NativeMethods.EVENT_OBJECT_STATECHANGE)))
     {
         PopupRootAutomationPeer popupRootAutomationPeer = UIElementAutomationPeer.CreatePeerForElement(popupRoot) as PopupRootAutomationPeer;
         if (popupRootAutomationPeer != null)
         {
             if (popupRootAutomationPeer.Hwnd == IntPtr.Zero)
                 popupRootAutomationPeer.Hwnd = Handle;
             IRawElementProviderSimple RootProviderForHwnd = popupRootAutomationPeer.ProviderFromPeer(popupRootAutomationPeer);
             IntPtr lResult = AutomationInteropProvider.ReturnRawElementProvider(Handle, IntPtr.Zero, new IntPtr(NativeMethods.OBJID_CLIENT), RootProviderForHwnd);
             if (lResult != IntPtr.Zero)
             {
                 IAccessible acc = null;
                 int hr = NativeMethods.S_FALSE;
                 Guid iid = new Guid(MS.Internal.AppModel.IID.Accessible);
                 hr = UnsafeNativeMethods.ObjectFromLresult(lResult, ref iid, IntPtr.Zero, ref acc);
                 if (hr == NativeMethods.S_OK && acc != null)
                 {
                     // Release IAccessible(acc) object, just trusting the GC
                     ;
                 }
             }
         }
     }
 }