MvxClosePresentationHint的MVVMCross回导航

本文关键字:导航 MVVMCross MvxClosePresentationHint | 更新日期: 2023-09-27 18:16:23

我有一个Xamarin iOS应用程序,我使用MVVMCross v3.2.1来控制视图控制器/视图模型之间的导航。我已经使用了ShowViewModel<TViewModel>();方法在视图模型之间导航,并且有一个特殊的情况,我想在导航堆栈上导航回一步。

我可以使用MvxClosePresentationHint来做到这一点,就像在ChangePresentation(new MvxClosePresentationHint(this));中一样,但是当它导航回以前的视图时,我需要刷新数据。

是否有任何MVVMCross视图模型生命周期方法,我可以我们检测回导航或我应该实现MvxMessage?

MvxClosePresentationHint的MVVMCross回导航

正如Cheesebaron建议的那样,我正在刷新以前的ViewController上的ViewWillAppear的数据,这似乎已经解决了这个问题。

 public override void ViewWillAppear(bool animated)
 {
     base.ViewWillAppear(animated);
     Refresh();
 }