title: How to handle the back button on Windows Phone 7
body: <p>On the windows phone 7 emulator, when the hardware back button is pressed, the default behaviour is for it to close your current application.  I want to override this default behaviour so that it navigates to the previous page in my application.</p>
  
  <p>After some research, it seems it should be possible to do this by overriding the OnBackKeyPress method, like so:</p>
  
  <pre><code>protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
  {
      // do some stuff ...
  
      // cancel the navigation
      e.Cancel = true;
  }
  </code></pre>
  
  <p>However, clicking the back button still closes my application. Putting a breakpoint on the above method reveals that it is never called.  I have another breakpoint on my application exit code, and this breakpoint <em>is</em> hit.</p>
  
  <p>Is there something else I need to do to intercept the back button?</p>