Xamarin.Forms to Native Navigation

Hi All,

I have integrated Xamarin.Forms to an existing native iOS application which I will be using to allow our clients to fill in specific police station forms. However I have hit a slight snag. The Forms2Native application proved very useful to wrap the Xamarin.Forms app into an existing UINavigationController.

Now, when I click the menu item to navigate to the Xamarin.Forms page, the navigation controller changes to the title "Forms" as I would expect but doesn't follow the navigation of the Xamarin.Forms pages wrapped in a Navigation Controller. Is there any way I can grab hold of the UINavigationController from inside Xamarin.Forms to push a new page rather than relying on the Xamarin.Forms navigation?

If this is a complex task, would an instructor who understands my problem be willing to let me use an Office Hours session to solve this?

Thanks

Answers

  • AdamLonsdale.3550AdamLonsdale.3550 GBUniversity ✭✭

    Would any instructors be able to offer Office Hours to cover this?

  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    I understand that you have your own native UINavigationController and would like to push a Forms Page onto that stack. Is that right? In this case, you should be able to get the iOS UIViewController from the page by calling CreateViewController() on it and the push it on the stack natively.

  • AdamLonsdale.3550AdamLonsdale.3550 GBUniversity ✭✭

    Hi René,

    Thanks for your reply I've already got the CreateViewController() going which I use to push the XF Page onto the native stack, however the XF Page has its own navigation to go to another page etc. and I'd like to update the Native UINavigationController's title so that it works correctly. Also when I go three pages deep into my XF logic and hit the back button, it simply returns me to the last native UIViewController I was on which I need to sort out.

    I feel like rather than using XF navigation I should be raising back to the Native navigation and pushing another XF page onto the stack

  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    I see. You'll have to abstract the navigation and then let the native app do the navigation. We have examples of a a simple navigation server implementation in the XAM320 class materials.

  • AdamLonsdale.3550AdamLonsdale.3550 GBUniversity ✭✭

    I assume this would be a case of raising events from XF back to the native UI somehow and then processing a new page at that point?

    I had a good look through the XAM320 class materials but I couldn't see anything that I was looking for, so I've signed up for that class.

  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    Hi @AdamLonsdale.3550 ! Something along these lines, yes. However to be honest, I think you maneuvered yourself into a corner. Mixing Forms and Native can work but it can also become very nasty. I don't know how much work it would be for you to convert over your screens to Forms entirely or to move everything to native, if Forms is not the correct choice.
    The examples that show navigation from/to Forms/Native exist but they send a wrong message - if you go with Forms, you should go all the way.

  • AdamLonsdale.3550AdamLonsdale.3550 GBUniversity ✭✭
    edited June 2015

    Thanks for your reply Rene, Like I said I'm a huge fan of Forms and I'd love to have the whole app in that platform. I might need to use some office hours to show me how to do some things.

    My only problem is that I have certain things native which my boss has become a big fan of. I initially started with the field service app and expanded it from there.

    Attached a couple of screenshots to show you what I have in the native side which I'm worried I won't be able to convert over. Or I might be able to with custom renderers which I'm yet to take the class on!

    1) 'Carousel' menu, slides around with different menu options

    2) The layout of this page

    3) Popover Control (which is actually a Xamarin.Forms View hosted inside a Popover View).

Sign In or Register to comment.