在视图上调用方法的简单方法(代码隐藏)
我有一个小问题,希望有人能帮助我解决。由于我设置第一次运行向导的方式,我必须在两个视图上调用 NavigationService.RemoveBackEntry() 。
据我所知,此方法需要在视图上(在代码隐藏中)调用,并且不能在我的视图模型中调用。
我想知道如果该方法存在于视图上,那么从 ViewModel 调用 RemoveLastNavEntry() 的最简单、最干净的方法是什么。
罗布表示,他将在某个时候将这一功能构建到导航服务中,但在那之前我需要将其作为一个小黑客来实现。
I have a small issue I was hoping somebody could help me with. I have to call the NavigationService.RemoveBackEntry() on two of my views due to the way I have my first run wizard set up.
This method needs to be called on the view (in the codebehind) as far as I am aware and cannot be called in my view models.
I was wondering what would be the easiest, cleanest way to call a RemoveLastNavEntry() from the ViewModel if the method lives on the view.
Rob has said it is a feature he will build into the navigation service at some point but until then I need to implement this as a minor hack.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然这确实是视图的一项任务,但如果您确实愿意,您可以从 ViewModel 中将其作为静态调用来调用。
请参阅 PhoneApplicationFrame。文档的RemoveBackEntry方法。
While this truely is a task for the view, you can, if you really want to, call it from the ViewModel, as a static call.
See PhoneApplicationFrame.RemoveBackEntry Method for documentation.