我有 PageA + ViewModelA 和 PageB + ViewModelB。
我从 A 调用 PushAsync(B),编辑一些数据,然后调用 PopAsync()。
所以现在 B 关闭,用户返回 A。
但是在 B 用户改变了一些状态,那应该在 A 上更新。通知 A 更新状态的正确方法是什么(最好能够访问 ViewModelB)。
方法:
1. In B call PopAsync(), from NavigationStack get ViewModelA and manually trigger some update method
2. [doesn't work for me] In A call PushAsync(B) and wait until B becomes closed, so after that perform update with access to VMB (PushAsync doesn't lock A, so this approach doesn't work)
似乎这两种方法都不正确。