Ejemplo n.º 1
0
        public static TAncestorType FindAncestorOrSelf <TAncestorType>(this Visual obj) where TAncestorType : Visual
        {
            TAncestorType ancestorType = obj as TAncestorType;

            if ((object)ancestorType != null)
            {
                return(ancestorType);
            }
            return(ExtensionMethods.FindAncestor <TAncestorType, DependencyObject>((DependencyObject)obj, new Func <DependencyObject, DependencyObject>(ExtensionMethods.GetVisualOrLogicalParent)));
        }
Ejemplo n.º 2
0
 public static TAncestorType FindAncestor <TAncestorType>(this Visual obj) where TAncestorType : Visual
 {
     return(ExtensionMethods.FindAncestor <TAncestorType, DependencyObject>((DependencyObject)obj, new Func <DependencyObject, DependencyObject>(ExtensionMethods.GetVisualOrLogicalParent)));
 }