2020.09.01.

How to add UWP to an existing Xamarin.Forms project

By bence960206

1.Click on the Solution and add a new UWP project.

2.Add to the UWP project this NuGet packaget: Xamarin.Forms.

3.Click on the Reference in the Portable project and add as reference your UWP project.

4.Go to the UWP project and open the APP.xaml.cs file and add this line:

// under this line

rootFrame.NavigationFailed += OnNavigationFailed;

// add this line

Xamarin.Forms.Forms.Init (e); // requires the `e` parameter

5. From the MainPage.xaml delete the contant of this element <Page> (just a Grid)

Add this:

xmlns:forms=”using:Xamarin.Forms.Platform.UWP”

6 . Change the <Page to <forms:WindowsPage

<forms:WindowsPage

xmlns:forms=”using:Xamarin.Forms.Platform.UWP”

</forms:WindowsPage>

7 . Open the MainPage.xaml.cs and delete this “: Page” after MainPage class name.

8 . Add this lane:

// after this line

this.InitializeComponent();

// add this line

LoadApplication(new YOUR_NAMESPACE.App());