private static bool IsPartOfTemplate(ViewItem parent, ViewItem childToCheck) { if (parent == (ViewItem)null || childToCheck == (ViewItem)null || !childToCheck.IsDescendantOf(parent)) { return(false); } foreach (ViewItem ancestor in parent.LogicalChildren) { if (ancestor == childToCheck || childToCheck.IsDescendantOf(ancestor)) { return(false); } } return(true); }
private static bool IsAdornableElement(DesignerView view, ViewItem element) { if (element != (ViewItem)null) { return(element.IsDescendantOf((Visual)view)); } return(false); }
internal static Transform GetTransformToAncestor(ViewItem childOrDescendant, ViewItem ancestor) { if (ancestor == (ViewItem)null) { throw new ArgumentNullException("ancestor"); } if (childOrDescendant == (ViewItem)null) { throw new ArgumentNullException("childOrDescendant"); } return((childOrDescendant.IsDescendantOf(ancestor) ? childOrDescendant.TransformToView(ancestor) as Transform : (Transform)null) ?? Transform.Identity); }