// 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);
        }
Пример #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);
        }
Пример #3
0
 private static void OnContextMenuSelectorPropertyChanged(FrameworkElement frameworkElement, ContextMenuSelector oldMenuSelector, ContextMenuSelector newMenuSelector)
 {
     SharedItemHelper.Share(frameworkElement, oldMenuSelector, newMenuSelector);
     PopupControlService.OnPopupControllerSelectorChanged(frameworkElement, oldMenuSelector, newMenuSelector);
 }