Question :
In previous versions it was possible to do such manipulation overwriting the OnBackKeyPress.
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
.
.
.
}
However, two errors are presented:
.OnBackKeyPress (System.ComponentModel.CancelEventArgs) ‘is a new
virtual member in sealed class
.OnBackKeyPress (System.ComponentModel.CancelEventArgs) ‘none
Appropriate method found to replace
How to do the same in the new version of Windows Phone?
Answer :
Are you creating a universal project?
Try:
public static event EventHandler<BackPressedEventArgs> BackPressed
try setting the BackPressedEventArgs.Handled property to true.
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
Frame frame = Window.Current.Content as Frame;
if (frame == null)
{
return;
}
if (frame.CanGoBack)
{
frame.GoBack();
e.Handled = true;
}
}