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);
 }
Example #2
0
 private static bool IsAdornableElement(DesignerView view, ViewItem element)
 {
     if (element != (ViewItem)null)
     {
         return(element.IsDescendantOf((Visual)view));
     }
     return(false);
 }
Example #3
0
 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);
 }