将页面重置为初始形式
我在我的应用程序中加载一个页面,用户对其进行一些修改。通过按该特定页面上的按钮,我想将该页面重置为其初始形式。我已经尝试过 NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.RelativeOrAbsolute));
但它不起作用,因为“From”和“To”页面是相同的。另外,我想过在中间添加一个新页面,但这听起来很糟糕。另外,如果我不必无缘无故地导航到另一个页面来破坏导航历史记录(即后退按钮),那就最好了。那么页面重置有什么解决方案吗?谢谢。
I load a page in my app, the user does some modifications on it. By the push of a button on that certain page, I want to reset the page to its initial form. I've tried NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.RelativeOrAbsolute));
but it doesn't work, since the From and To pages are the same. Also, I have thought of putting a new page in between, but it sounds bad. Also, it would be best if I didn't have to screw the Navigation History (i.e. the back button) by navigating without reason to another page. So any solution for a page reset? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了正确的答案。为了将页面重置为其初始形式,您必须执行以下操作:
它对我有用。 :)
I found the right answer. In order to reset the page to its initial form you have to do this:
It worked for me. :)
我是通过以下方式完成的:
这将包含我的网页 page1、page2 等的 contentFrame 设置为该页面的全新实例。然后,这将重新加载该页面上的所有内容、布局,并再次从数据库中获取数据。这种方法对我有用。
I did it in the following way:
this sets the contentFrame, which contains my webpages page1,page2 etc, to a brand new instance of that page. This then reloads everything on that page, the layout and also gets the data back from the database again. This way worked for me.