简体   繁体   English

Windows Phone - UserControl中的OnNavigatedTo和OnNavigatedFrom

[英]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. OnNavigatedToOnNavigatedFrom是导航服务在导航页面时引发的方法,这些方法是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.

相关问题 OnNavigatedTo神秘地不在Windows Phone 7上触发 - OnNavigatedTo mysteriously not firing on Windows Phone 7 处理ViewModel中的OnNavigatedFrom / OnNavigatedTo事件 - Handling the OnNavigatedFrom / OnNavigatedTo events in the ViewModel UserControl中的Windows Phone UIElementCollection - Windows Phone UIElementCollection in UserControl 如何使用OnNavigatedFrom和OnNavigatedTo事件在页面之间传递数据 - How to Pass Data Between Pages using OnNavigatedFrom and OnNavigatedTo Events 将NavigationService传递给UserControl Windows Phone 7 - Passing NavigationService to Usercontrol windows phone 7 Windows Phone-使用OnNavigatedFrom的NavigationEventArgs传递数据。 会有内存泄漏吗? - Windows Phone - Passing Data With OnNavigatedFrom's NavigationEventArgs. Can there be memory leak? Windows Phone应用程序从逻辑删除恢复时,OnNavigatedTo方法的导航模式是什么? - What's the navigation mode of OnNavigatedTo method when Windows Phone application restore from tombstoning? 在Mango OS中,OnNavigatedFrom在OnNavigatedTo之前被调用。 如何找到解决方法? - In Mango OS OnNavigatedFrom is called before OnNavigatedTo. How to find work around for this? 使用手势Windows Phone关闭UserControl弹出窗口 - Close UserControl Popup with Gestures Windows Phone 在XAML中绑定UserControl的DataContext不起作用(Windows Phone) - Binding the DataContext of a UserControl in XAML is not working (Windows Phone)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM