Bug 35288 - Back navigation action does not trigger OnBackButtonPressed event for Pages
Summary: Back navigation action does not trigger OnBackButtonPressed event for Pages
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 1.5.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-10-27 06:29 UTC by Dmitijs Jesilevskis
Modified: 2016-04-13 18:54 UTC (History)
1 user (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Sample project for Bug description (503.70 KB, application/x-zip-compressed)
2015-10-27 20:09 UTC, Dmitijs Jesilevskis

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Dmitijs Jesilevskis 2015-10-27 06:29:24 UTC
1) Create a Windows 8.1 Xamarin.Forms application with PCL-based code sharing strategy;
2) Implement the following scenario:
2.1) Use NavigationPage for navigation strategy;
2.2) Page A opens at startup;
2.3) Page A navigates to Page B using PushAsync();
2.4) Override OnBackButtonPressed() for Page B;
3) Use Back arrow, or hardware back (mouse with "Back" functionality) to navigate from Page B to Page A.

- Overriden OnBackButtonPressed() is fired when leaving Page B using "Back" functionality;

- Overriden OnBackButtonPressed() is not executed.

Xamarin.Forms version:
target framework: portable45-net45+win8+wp8+wpa81
Comment 1 Rui Marinho 2015-10-27 14:36:41 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue we would very much appreciate it.

And with a reminder OnBackButtonPressed is only called if  you use the hardware button.

Warm regards,
Xamarin Forms Team
Comment 2 Dmitijs Jesilevskis 2015-10-27 20:09:37 UTC
Created attachment 13552 [details]
Sample project for Bug description

I'm attaching the sample project.
Sample project includes Windows 8.1 (WinRT) client and Windows Phone 8.1 (WinRT) client.

From Start Page (Page A) user navigates to Remote Page (Page B).
Remote Page does not have any back navigation, so user is forced to use "global back" mechanism.
In case of Windows Phone 8.1, "global back" is a hardware back button and OnBackButtonPressed() operation is called as expected.

In case of Windows 8.1, "global back" is represented in two ways:
A) The "Back" arrow at the top left side of the screen;
B) The global windows "Back" command, that can be invoked either from some keyboards (usually associated with "Back" for Browsers), or from PC mouse.

Despite the way user chooses to navigate from Remote Page to Start Page on Windows 8.1, the OnBackButtonPressed() operatio is NOT invoked.

The "Back" arrow may not be strictly fitting into hardware button definition, but it's the only option available to tablets/convertible notebook (e.g. Lenovo Yoga) users to navigate.
Comment 3 Rui Marinho 2015-10-28 08:00:25 UTC
Hi, ok, i understand the problem, but OnBackButtonPressed will be only invoked on hardware buttons, so in this case the mouse back command.