protected void Bind(TViewId id, IView view) { Type viewModelType = FindViewModelType(id); var viewModelContext = _contextFactory.CreateExport(); NavigatableViewModel viewModel = (NavigatableViewModel)viewModelContext.Value.GetExport(viewModelType); view.Bind(viewModel); // Note: we do not dispose the viewModelContext because we do not want to dispose the parts it created }
public void Navigate(NavigatableViewModel newViewModel) { if (newViewModel.Navigator != null && newViewModel.Navigator != this) { throw new Exception("Viewmodel can't be added to two different navigators"); } newViewModel.Navigator = this; if (CurrentViewModel != null) { CurrentViewModel.NextViewModel = newViewModel; } newViewModel.PreviousViewModel = CurrentViewModel; CurrentViewModel = newViewModel; }