Ejemplo n.º 1
0
        public static bool xContainsDescendant(this DependencyObject parent, object x)
        {
            var dependencyObject = x as DependencyObject;

            while (dependencyObject != null)
            {
                dependencyObject = DependencyObjectEx.GetParent(dependencyObject);
                if (dependencyObject == parent)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
 public static T xFindAncestorFromMe <T>(this DependencyObject source) where T : DependencyObject
 {
     try
     {
         while (source != null && !(source is T))
         {
             source = DependencyObjectEx.GetParent(source);
         }
     }
     catch (Exception e)
     {
         Log.Exception(e);
     }
     return((T)((object)source));
 }