开发者

WP7 back key press handling in child popup

I made a usercontrol that contains a togglebutton. When the user clicks on it, it shows a fullscreen-sized popup. I want to add the following functionality: when the user presses the hardware back button and the popup is opened, close the popup. The problem is that only the parent page of the usercontrol has backkeypress event. How can I handle this in开发者_如何学运维side the usercontrol which is a reusable control? I try to avoid handling backbutton press in the page's code, so handling this like calling a method of the usercontrol from the page's OnBackKeyPress eventhandler is the last thing I'd like to do (the page is programmatically generated)...


The control will need to find a reference to the page somehow - either in the constructor, or by walking up the UI tree until it finds a PhoneApplicationPage. It can then subscribe to the event itself, and unsubscribe from the event when it's closed.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜