我使用的是Prism Unity,我有一个抽象的RecordViewModel:BindableBase,RecordListViewModel:RecordViewModel和RecordUpdateViewModel:RecordViewModel,INavigationAware。还有一个单独的导航模块,我的MainWindow有2个区域,NavigationRegion和ContentRegion。所有RecordViews都位于ContentRegion中。无论出于何种原因,无论我单击“返回”按钮还是单击NavigationRegion中的按钮,我都无法离开“更新”视图。我已经缩小了问题所在的是ViewModel,而我缺少了一些InavigationAware的东西。请告诉我我缺少或做错了什么,谢谢。
public class RecordUpdateViewModel : RecordViewModel, INavigationAware
{
private IRegionNavigationJournal navigationJournal;
public RecordUpdateViewModel(IRecordService context) : base(context)
{
}
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return false;
}
public void OnNavigatedFrom(NavigationContext navigationContext)
{
throw new NotImplementedException();
}
public void OnNavigatedTo(NavigationContext navigationContext)
{
//irrelevant to problem logic to bring in Record.Id
navigationJournal = navigationContext.NavigationService.Journal;
}
}
汪汪一只猫
慕婉清6462132
相关分类