Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Created December 23, 2016 12:09
public static void Navigate<T>(Window w, object context){
((Frame) w.Context).Navigate(typeof(T),
new NavigationParameters{
ViewModel = GetViewModel<T>(),
Context = context ?? GetContext<T>()
});
}
private static object GetViewModel<T>(){
if (typeof (T) == typeof(Vehicle)){
return Factory.CreateVehicleViewModel();
}
...
throw new NotImplementedException("Can't navigate to such page");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment