internal static T FindParentOfType <T>(this Xamarin.Forms.VisualElement element) { var navPage = element.GetParentsPath() .OfType <T>() .FirstOrDefault(); return(navPage); }
internal static IEnumerable <Element> GetParentsPath(this Xamarin.Forms.VisualElement self) { Element current = self; while (!Xamarin.Forms.Application.IsApplicationOrNull(current.RealParent)) { current = current.RealParent; yield return(current); } }