PrismApplication not allowing Xamarin forms to initialize - xamarin

I have a UWP, Xamarin forms sample from http://thatcsharpguy.com/post/xamarin-forms-uwp/
I am trying to add prism by changing the app to a PrismApplication and can't figure out how to call Xamarin.Forms.Forms.Init(e); before the app class constructor call.
I get a {"You MUST call Xamarin.Forms.Init(); prior to using it."}.
Where can I call this?

I'm not sure exactly what you are doing because you haven't provided any code, but you don't have to do anything special to the UWP app. Set the UWP app up like a normal Xamarin Forms application. The only place you will modify is the Xamarin Forms PCL project. To make it easy, just use the Prism Template Pack from the visual studio gallery. Create a new Xamarin Forms Prism application and everything will be hooked up for you.
https://visualstudiogallery.msdn.microsoft.com/e7b6bde2-ba59-43dd-9d14-58409940ffa0

Related

Accessing Application.Current.Properties from native Android Xamarin

I have a Xamarin Forms app and I am adding an AppWidget to the native Android Xamarin project to give users a widget which they can pin on their home screen and use to interact. The Xamarin Forms app stores state in
Application.Current.Properties["MyId"]
How can I access this from the native Android Xamarin code, since Application is in the Xamarin.Forms namespace?
To access Application.Properties from projects native like Android or iOS. Please use the simple code snippet
var myId = Xamarin.Forms.Application.Current.Properties["Id"];

Runtime checks for android in xamarin forms

How do i implement runtime checks in a Xamarin forms project for the android platform, most of my code is in the PCL. So how can i write checks for the apis being used since im not calling them form xamarin.android but from the PCL and i don't know the android specific apis being used?

XAML in Xamarin.iOS and Xamarin.Android

I was giving an interview for a company and I was told by the architect that they are creating iOS apps from Xamarin.iOS ( NOT Xamarin Forms) with MvvmCross framework and they use storyboards for UI. But if the UI is very simple they use XAML to create them.
I never knew we can use XAML for Xamarin.iOS and Xamarin.Droid. We had a small discussion/argument if that's even possible. He said they were using it successfully.
My question, is it really possible to use XAML in Xamarin.iOS and Xamarin.Droid. Because, if we can do that, I feel no use of using Xamarin forms.
If yes, can anyone provide some kind of documentation?
Thank you.
There is no way to design UI in XAML using Xamarin.Android or Xamarin.iOS, but you can include Xamarin.Forms page in Xamarin.Android or Xamarin.iOS app. This way you can have native app with UI using storyboards, but with some Xamarin.Forms pages designed in XAML.
There is a sample how to do that in Xamarin Forms samples project on GitHub.
Only Xamarin Forms support sharing of UI via XAML.
UI for iOS has to be made using xib or storyboard.
For Android using AXML.
Windows Phone, UWP, WinPhone Silverlight, Windows can use XAML for UI.

How can we Integrate Xamarin.Forms Application/Component with Xamarin native Application?

I have developed an app/component using Xamarin.Forms and as per the requirement I need to integrate that component with another app which is developed on Xamarin Native in Android as well as iOS.
Kindly help me with the suggestions or references
I've seen something like that on a sample called Native2Forms.
What it does, at least in Android, is to use a separete activity to integrate the Xamarin Forms PCL (FormsActivity).

Adding a Xamarin Form to Xamarin iOS unified app

I have a Xamarin iOS unified app.
I want to add a Xamarin form to it.
How can I do this?
Thanks,
Kaustubh
-You can not do it directly.
-Create a Xamarin PCL project, it will create a shared project and native projects to iOS and Android
-You can add you Xamarin native project, necessary files to it
-Create a page renderer in Xamarin Forms Shared project
-Use it to load required page from native project
-Page renderer will act as a native page.You can call your native functions, UI from that point onwards.
Xamarin forms is a kind of project, not a form you can add to a project that is not xamarin forms
You can just add a new project of type Xamarin.Forms in your solution and you'll then have to port your code or share as much as possible through a PCL.
Source and reference : developer.xamarin.com/guides/cross-platform/xamarin-forms/
[Edited to take comments into accounts]

Resources