Bug 21575 - NavigationPage CreateViewController does not generate UINavigationController
Summary: NavigationPage CreateViewController does not generate UINavigationController
Status: RESOLVED INVALID
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.1
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-24 13:21 UTC by Chris Riesgo
Modified: 2014-11-28 07:43 UTC (History)
6 users (show)

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


Attachments
Repro Case (78 bytes, text/plain)
2014-07-24 13:21 UTC, Chris Riesgo
Details


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:
Status:
RESOLVED INVALID

Description Chris Riesgo 2014-07-24 13:21:03 UTC
When setting a NavigationPage as my root page in a Xamarin.Forms.iOS app, the ViewController that is generated by the call to CreateViewController() is not of type UINavigationController. 

I would think that on iOS, (NavigationPage).CreateViewController() would generate a ViewController of type UINavigationController.

I have a simple repro case here:
https://github.com/chrisriesgo/repro/tree/master/XF_RootAsNavigationController
Comment 1 Chris Riesgo 2014-07-24 13:21:39 UTC
Created attachment 7482 [details]
Repro Case
Comment 2 Jason Smith [MSFT] 2014-07-24 13:50:12 UTC
No, it will still be nested within a parenting ViewController that we use to handle certain events. It will be the ChildViewController of the ViewController you get from CreateViewController.
Comment 3 Chris Riesgo 2014-07-24 14:15:36 UTC
Duly noted. Thanks.
Comment 4 Yiannis 2014-08-01 22:46:38 UTC
@Jason Smith how can we get a reference of this ChildViewController? 
navigationPage.CreateViewController().ChildViewControllers[0] is an empty array.

for example this code:

Xamarin.Forms.Forms.Init ();
var navp = new Xamarin.Forms.NavigationPage ();
UIViewController navc = navp.CreateViewController (). ChildViewControllers[0];
var nav = (UINavigationController)navc;

raises an index out of range exception because the ChildViewControllers collection is empty
Comment 5 Subha 2014-11-28 07:43:32 UTC
Why this thread is marked as 'RESOLVED INVALID'. I am also facing similar issue, and I posted question related to this in Xamarin forum, but I didn't get any response. 

http://forums.xamarin.com/discussion/27651/how-to-add-navigation-bar-to-ios-page-opened-from-xamarin-forms-page

All my Forms pages are wrapped under NavigationPage class, hence all pages has NavigationBar with back button. I have a page created in iOS which I am inserting using dependency injection. Its working fine, but navigation bar is not shown in iOS specific page. Hence its very difficult to navigate back to the previous page.

How to solve this?