Xamarin.Forms: Create Your First Xamarin App For iOS, Android, And Windows

Step 1

Create a Xamarin.Forms Project with Portable Class Library (PCL).

Go to File, New Project, Visual C#, Cross -Platform, Blank App (Xamarin.Forms Portable), then Name it “HelloXamarin” and Click OK.

Note - Make sure install all the required tools i.e. Xamarin for Visual Studio and all other Android SDKs too.

create

Step 2

When the project is fully created or loaded then you will see something like this in Solution Explorer.

Solution Explorer

Here, we can see different projects for each platform i.e. Android, iOS, UWP (Universal Windows Platform), Windows 8.1 and Windows Phone 8.1.

And Portable is the Class library where we write all our common code base for all the platforms.

Step 3

Inside the Portable class Library Projects, in App.cs we can see default code which is ready to run.

code

Step 4

Now let’s run this default project. You can run the Android project in Android emulator or Windows Project in Windows devices. For iOS you need MacBook. So I am going to run in my Windows Phone Device.

Right Click on the Windows Phone 8.1 project and set it as startup project.

code

Step 5

Run the Project and you will see the output as following in your device. This output is same for all platforms.

output


Similar Articles