如何在visual studio中刷新页面? [英] how to refresh a page in visual studio?
问题描述
我创建了一个 Windows 手机应用程序.在每个页面中,我都使用NavigationService.GoBack()"命令给出了一个后退按钮.我希望当按下后退按钮时,它导航到的上一页必须再次执行该页面的整个代码.
如果您依赖用户按下硬件后退按钮,则不必自己调用 GoBack()
.>
要在用户导航回页面时刷新页面,您可以在页面中使用以下内容(并根据需要添加刷新代码):
protected override void OnNavigatedTo(NavigationEventArgs e){base.OnNavigatedTo(e);if (e.NavigationMode == NavigationMode.Back){//在这里刷新一下}}
i have created a windows phone application. In each page i have given a back button using "NavigationService.GoBack()" command. i want that when the back button is pressed the previous page to which it navigate the whole code of that page must again be executed.
If you're relying the user pressing the hardware back button you shouldn't have to call GoBack()
yourself.
To refresh a page when the user navigates back to it you can use the following in your page (and add the refresh code as appropriate):
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.Back)
{
// Do your refreshing here
}
}
这篇关于如何在visual studio中刷新页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!