带有新参数的WPF重新加载页面

时间:2014-05-01 14:05:46

标签: c# wpf

我的程序是从世界级到县级的。当我坐在国家时,我就这样使用它:

this.NavigationService.Navigate(new Country("Italy"));

从Country类我希望用户可以切换国家/地区,但不能调用

this.NavigationService.Navigate(new Country("USA"));

因为我希望保留我的选择回到世界。所以我需要这样的事情:

this.NavigationService.GoBack(); //not works
this.NavigationService.Navigate(new Country("UK"));

但背部似乎不起作用。那么如何用新参数刷新我的Country类,像Refresh这样的东西(“英国”)?

1 个答案:

答案 0 :(得分:2)

您可以尝试通过调用RemoveBackEntry()方法

来从导航回写堆栈中删除以前的国家/地区页面
//refresh page with new country USA
this.NavigationService.Navigate(new Country("USA"));
//remove previous country Italy from back stack
//so that back option will bring the application to World page
this.NavigationService.RemoveBackEntry();
相关问题