[英]Windows Phone - OnNavigatedTo and OnNavigatedFrom in a UserControl
How can I get the OnNavigatedTo and OnNavigatedFrom events to fire in a Windows Phone UserControl? 如何在Windows Phone UserControl中触发OnNavigatedTo和OnNavigatedFrom事件? My UserControl is inside of a bound ListBox so there are a varying number of them, so I think I need to raise an event in the page and have the UserControls tap into and handle those events, but I don't know how to do that. 我的UserControl在一个绑定的ListBox中,所以它们有不同的数量,所以我想我需要在页面中引发一个事件并让UserControls进入并处理这些事件,但我不知道该怎么做。
OnNavigatedTo
and OnNavigatedFrom
are the methods raised by navigation service when a page is navigated these methods are a part of Page
class. OnNavigatedTo
和OnNavigatedFrom
是导航服务在导航页面时引发的方法,这些方法是Page
类的一部分。
For your problem, what you can do is you can make your user control to be derived from Page
class and then setting the Navigation
context and Navigation
service for the same. 对于您的问题,您可以做的是您可以使您的用户控件从Page
类派生,然后为其设置Navigation
上下文和Navigation
服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.