Is there any way to put a ContentPage-based app in a ContentView?

DaveBoggustDaveBoggust USMember, University ✭✭

I have developed a Forms app and the app pages derive from ContentPage. However the functionality is now required to be built into an existing (non-Forms) Xamarin app, the "host" app. The host app is trying to display the app in a window but it is expecting a ContentView based app (tested with a simple "HelloWorld" Forms app) and not a ContentPage-based one. Is it in anyway possible to put my ContentPage-based app in the ContentView? Or should it be possible to open a ContentPage-based app in a fullscreen window from within the non-Forms app?

Best Answer

Answers

  • DaveBoggustDaveBoggust USMember, University ✭✭
    edited January 2016

    Ok, to clarify why I may want to do this, the existing app (the "host") was written a few years ago using plain old Xamarin and uses an old version of a toolkit/framework from Resco for the forms in the UI (i.e. it pre-dates Xamarin Forms). That app is still widely used and is not being re-written. However, I was tasked with writing a Forms app which I have done and it was intended to be a standalone app but now it has been requested that the new app be accessible from within the host app. So when you click a button it should open a window and display the Forms app. A test was successfully done where the app in the window was a ContentView-based app but isn't currently working for a ContentPage-based one. That is the reason for my question. I realize that it is not a conventional scenario, but I'm just looking for some guidance as to whether or not it is even possible. I hope that makes sense... :smile:

  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    Like I said: it's not a supported scenario. Even if you get it to work, it will be prone to error with upcoming releases of iOS and X.Forms. I recommend to stay away from hacks like this.

    Instead, why not have two separate apps and launch the one from the other using a URI scheme? On iOS9 you'd even get a small "back to previous app" indicator in the status bar.

Sign In or Register to comment.