示例#1
0
 /// <summary>
 /// Returns the currently visible ViewModel
 /// </summary>
 public static INavigatableViewModel GetCurrentViewModel(this NavigationState This)
 {
     return(This.NavigationStack.LastOrDefault());
 }
示例#2
0
 /// <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());
 }