且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

单击后退按钮(WP7)刷新或更新页面

更新时间:2023-12-02 23:13:52

NavigationService.GoBack();是正确的方法.您需要关注的问题是:如何在返回帐户"页面时刷新数据".解决方案取决于您的应用程序的体系结构.如果您使用了MVVM模式,则只需将新帐户添加到视图模型中的数据源即可.否则,您可能应该在页面的OnNavigatedTo方法中重新加载帐户列表:

NavigationService.GoBack(); is the right way. The problem you need to focus on is: "how to refresh the data when going back to the Accounts Page". The solution depends on your application's architecture. If you used the MVVM pattern, then it's just a matter of adding the new account to the data source in the viewmodel. Otherwise, you should probably reload the account list in the OnNavigatedTo method of your page:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    // Load the accounts
}