BindableApplicationBar.UIElementExtensions.IsInVisualTree C# (CSharp) Method

IsInVisualTree() public static method

public static IsInVisualTree ( this element ) : bool
element this
return bool
        public static bool IsInVisualTree(this UIElement element)
        {
            DependencyObject dob = element;
            DependencyObject parent = VisualTreeHelper.GetParent(dob);

            while (parent != null)
            {
                dob = parent;
                parent = VisualTreeHelper.GetParent(dob);
            }

            return dob is PhoneApplicationFrame;
        }
    }
UIElementExtensions