Reputation: 95
I am trying to detect back button for windows phone 7 so far I have been using BackKeyPress() event, but it did not work? Instead of changing the page (when clicking back button on phone), it goes straight to menu! Why is that?
Code:
//BackKeyPress event handler
private void LeaveWindow(object sender, System.ComponentModel.CancelEventArgs e)
{
this.Content = new MainPage();
}
Upvotes: 0
Views: 53
Reputation: 669
Did you try:
protected override void OnBackKeyPress(CancelEventArgs e)
{
e.Cancel = true;
}
Upvotes: 1