In Windows Phone 7ProgramIn development, there is no way to exit the program, you can only use the back button on the phone.
If you want to click the back button on the page to exit, a dialog box will pop up to confirm with the user, which can be implemented as follows:
1PublicMainpage ()
2{
3Initializecomponent ();
4
5This. Backkeypress + =NewEventhandler <system. componentmodel. canceleventargs> (mainpage_backkeypress );
6}
VoidMainpage_backkeypress (ObjectSender, system. componentmodel. canceleventargs e ){If(MessageBox. Show ("Are you sure you want to exit the program?","Reminder", Messageboxbutton. okcancel) =Messageboxresult. Cancel) {e. Cancel=True;//Operation canceled}}
Define the exit button handler:
When the input method is called, clicking the back button only hides the input method and does not trigger the backkeypress event on the page.