public static bool IsDescendantOf(object visual, object rootVisual) { if (visual is Visual && rootVisual is Visual) { return(((Visual)visual).IsDescendantOf((Visual)rootVisual)); } if (DXMethods.IsFrameworkRenderElementContext(visual) && DXMethods.IsFrameworkRenderElementContext(rootVisual)) { return(RenderTreeHelper.RenderAncestors((visual)).Any(x => x == rootVisual)); } if (DXMethods.IsFrameworkRenderElementContext(visual) && rootVisual is Visual) { return(DXMethods.GetParent(((dynamic)visual).ElementHost).Parent.IsDescendantOf((Visual)rootVisual)); } return(false); }
public static bool IsDescendantOf(object visual, object rootVisual) { if (visual is Visual && rootVisual is Visual) { return(((Visual)visual).IsDescendantOf((Visual)rootVisual)); } var visualFrec = visual.Wrap <IFrameworkRenderElementContext>(); if (visualFrec != null && rootVisual.Wrap <IFrameworkRenderElementContext>() != null) { return(RenderTreeHelper.RenderAncestors(visual).Any(x => x == rootVisual)); } if (visualFrec != null && rootVisual is Visual) { return(visualFrec.ElementHost.Parent.IsDescendantOf((Visual)rootVisual)); } return(false); }
public static bool IsVisible(IFrameworkRenderElementContext context) { return(isVisible(context) && context.ElementHost != null && RenderTreeHelper.RenderAncestors(context).Select(x => x.Wrap <IFrameworkRenderElementContext>()).All(x => isVisible(x))); }
public static bool IsVisible(object context) { return(isVisible(context) && RenderTreeHelper.RenderAncestors(context).All(x => isVisible(x))); }