Bug 29257 - CarouselPage.CurrentPage Does Not Work Properly When Used Inside a NavigationPage
Summary: CarouselPage.CurrentPage Does Not Work Properly When Used Inside a Navigation...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.5.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Rui Marinho
: 28626 33701 ()
Depends on:
Reported: 2015-04-20 18:07 UTC by Jimmy [MSFT]
Modified: 2016-04-08 19:43 UTC (History)
15 users (show)

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

Repro project (176.20 KB, application/zip)
2015-04-20 18:07 UTC, Jimmy [MSFT]

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 Jimmy [MSFT] 2015-04-20 18:07:02 UTC
Created attachment 10830 [details]
Repro project

=== Overview === 
On Android, when pushing a CarouselPage with its CurrentPage set to a page at an index other than 0, it results in a blank page. When the CarouselPage is swiped to the first page, it causes the content on all the children pages to load, including the blank one that was originally pushed.

I tested this with a CarouselPage that had five children and the issue occurred whenever the CarouselPage was pushed with the CurrentPage set to the pages at index 1 or 2. It worked as expected with all other indexes.

The bug occurs on Forms 1.4.1 and 1.42.-pre2.

=== Steps to Reproduce ===
1. Download and run the repro project an Android device/emulator
2. Select “Page 1”
3. Swipe right and observe that all children pages contain a label
4. Press the back button to return to the list of pages
5. Select “Page 2”
6. Observe that the page is blank
7. Swipe left to the first page and label is rendered on the page
8. Swipe back to the second page and the label is now also rendered

=== Actual Results ===
When the CurrentPage property is set to a child page at index 1 or 2, the page is rendered blank. Only after swiping to the first page are all the children pages rendered correctly.

=== Expected Results === 
The CarouselPage.CurrentPage should be rendered correctly when it is first pushed, regardless of what index page it is set to.

=== Environment Info ===
=== Xamarin Studio ===

Version 5.8.3 (build 1)
Installation UUID: 94ce5106-6a72-4691-b34e-cd5857b1db66
	Mono 3.12.1 ((detached/0849ec7)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010003

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/jimmygarrido/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: f7736a4
Build date: 2015-04-09 04:22:08-0400

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 508030001
Git revision: 6e8e725e0d689351901c2c70453bfa4ea25e293b
Build date: 2015-04-06 20:31:47-04
Xamarin addins: 051cd5f8c1b5dbfc87eaef80a74aec03f34c60a8

=== Operating System ===

Mac OS X 10.10.3
Darwin Jimmys-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 2 Avidan Chen 2015-05-14 02:53:44 UTC
+1 This happens for us too.
Comment 3 Tal Abraham 2015-05-14 03:37:10 UTC
Comment 4 Noam Ofek 2015-06-04 11:27:56 UTC
Comment 5 Rui Marinho 2015-08-20 07:48:44 UTC
*** Bug 28626 has been marked as a duplicate of this bug. ***
Comment 6 PetrC 2015-08-22 17:20:41 UTC
here is a workaround i use in a constructor of CarouselPage:

            CurrentPage = Children[0];
            new Thread(async () =>
                await Task.Delay(500);
                CurrentPage = Children[index];
Comment 7 Rui Marinho 2015-10-14 13:12:44 UTC
*** Bug 33701 has been marked as a duplicate of this bug. ***
Comment 8 Rui Marinho 2015-10-15 17:03:35 UTC
Should be fixed in 1.5.2-pre1
Comment 9 Parmendra Kumar 2015-10-26 09:21:29 UTC
I have checked this issue with Xamarin.Forms 1.5.2-pre1 and I am still getting same behavior mentioned in bug description. Hence reopened this issue.

Screencast: http://www.screencast.com/t/iY7ILPi2MD

Please follow the screencast and please let me know If I have misses anything.

ApplicationOutput: https://gist.github.com/Parmendrak/e5e61889a75dc88a3c6a
XAP Log: https://gist.github.com/Parmendrak/b7618195497316bebcb2

Environment info:
Xamarin Studio 5.10 (build 848)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
Mono 4.2.1 (explicit/fc228e4)
GTK+ 2.24.23 (Raleigh theme)
Xcode 7.0 (8227)
Xamarin.Android : (Enterprise Edition)
Xamarin.iOS: (Enterprise Edition)
Mac OS X 10.10.5
Comment 10 Rui Marinho 2015-10-28 08:08:46 UTC
You have to use the new AppCompatActivity support, please see instructions here :

Comment 11 Iurii 2016-01-05 12:28:38 UTC

Comment 12 Parmendra Kumar 2016-01-05 15:12:29 UTC

I have checked this issue as mentioned instruction in comment #10 and I am getting exception.

Exception: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

Screencast: http://www.screencast.com/t/VwgAtWrf

Please see the screencast and let me know if I have missed anything.