/// <summary> /// Returns the currently visible ViewModel /// </summary> public static INavigatableViewModel GetCurrentViewModel(this NavigationState This) { return(This.NavigationStack.LastOrDefault()); }
/// <summary> /// Locate the first ViewModel in the stack that matches a certain Type. /// </summary> /// <returns>The matching ViewModel or null if none exists.</returns> public static T FindViewModelInStack <T>(this NavigationState This) where T : INavigatableViewModel { return(This.NavigationStack.Reverse().OfType <T>().FirstOrDefault()); }