Bug 30353 - MasterDetailPage.IsPresentedChanged is not raised
Summary: MasterDetailPage.IsPresentedChanged is not raised
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Rui Marinho
Depends on:
Reported: 2015-05-22 10:58 UTC by Michael Rumpler
Modified: 2015-08-07 06:29 UTC (History)
9 users (show)

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

repro (282.88 KB, application/x-zip-compressed)
2015-05-22 16:34 UTC, Chris King

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 Michael Rumpler 2015-05-22 10:58:53 UTC
The IsPresentedChanged event on a MasterDetailPage is not always raised.

To reproduce create a new empty project and replace the App constructor with this code:

	public App()
		// The root page of your application
		var md = new MasterDetailPage
			Master = new ContentPage
							Title = "IsPresentedChanged Test",
							BackgroundColor = Color.Green,
							Content = new Label
								HorizontalOptions = LayoutOptions.CenterAndExpand,
								VerticalOptions = LayoutOptions.CenterAndExpand,

								Text = "Master"
			Detail = new ContentPage
							BackgroundColor = Color.Gray,
							Content = new Label
								HorizontalOptions = LayoutOptions.CenterAndExpand,
								VerticalOptions = LayoutOptions.CenterAndExpand,
								Text = "Detail"
			MasterBehavior = MasterBehavior.Popover,
		md.IsPresentedChanged += (s, e) => System.Diagnostics.Debug.WriteLine("The Master is now {0}", md.IsPresented ? "visible" : "invisible");

		MainPage = md;

You can see in the Debug window if the event is raised.

When you start the app on an iPad, then you can slide the Master out and back in and the event is raised. If you slide the Master away and rotate the device from portrait to landscape or vice versa, then you can still slide the Master in and out and the event is raised.
But if the Master is visible while you rotate the device, then the IsPresentedChanged event won't be raised anymore.

I also tested this on a Google Nexus 10 tablet. Here again everything works as long as the Master is not visible while you rotate the device. But if the Master is visible during the rotation, then it will be hidden after the rotation and the next slide out and slide in events won't be raised. After that it works as it should again.

I didn't test this on any phones.

I tested this with Xamarin.Forms and
Comment 1 Chris King 2015-05-22 16:34:54 UTC
Created attachment 11303 [details]
Comment 2 Chris King 2015-05-22 16:36:05 UTC
Indeed. Open master page, rotate (causes master page to hide), then swipe to open master. Expected on visible event but actually no event on Nexus 7 tablet.
Comment 3 Michael Rumpler 2015-05-23 03:53:36 UTC
I would also expect the master to stay visible when the device is rotated on Android.

Chris, could you please change the status to Confirmed.
Comment 4 Michael Rumpler 2015-05-29 07:45:50 UTC
One more thing which could help finding the bug: I saw that the Masters Appearing event is also not raised anymore on iOS when this happens.
Comment 5 Michael Rumpler 2015-07-03 05:31:47 UTC
May be related to https://bugzilla.xamarin.com/show_bug.cgi?id=31602. Both bugs happen when you rotate a device with a MasterDetailPage.
Fixing them together should be less effort.
Comment 6 Jason Smith [MSFT] 2015-08-05 15:03:26 UTC
Should be fixed in 1.5.0-pre1
Comment 7 Parmendra Kumar 2015-08-07 06:29:25 UTC
I have checked this issue with 1.5.0-pre1 and its working fine at my end.

Hence closing this issue.