开发者

WP7 Timepicker OnNavigatedTo fired again after finishing time selection

开发者 https://www.devze.com 2023-03-14 11:04 出处:网络
I have a page that I am navigating to that does some setup stuff via the \'OnNavigatedTo\' event. Thso page contains a TimePicker control and I have discovered that when I finish in the Timepicker co

I have a page that I am navigating to that does some setup stuff via the 'OnNavigatedTo' event.

Thso page contains a TimePicker control and I have discovered that when I finish in the Timepicker control and focus returns back to my page it is again going through the 'OnNavigatedTo' event.

As a result is doing setup stuff again that is mucking things up, and if even has the same NavigationContext.Quer开发者_运维百科yString as when I originally navigated to that page.

I assume I cannot avoid this event being called again - but is there any way to know that I have come here as a result of exiting the Timepicker control?

  • thanks


What about defining a bool in the class (instance-level, not static) that you set check in OnNavigatedTo -- if false, then do your work and set to true. Now, I'm not 100% sure that this works if you go back one level further and then tap on whatever brought up this page, so check that. Also, check to ensure everything works with tombstoning -- that's where you're more likely to have problems.

--randy

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号