In this post, we’ll into look very basic HelloWorld example of Xamarin.Forms cross platform mobile apps. We’ll create a simple Hello World app using Xamarin Forms which will be cross platform. Later on, we’ll run this app both on Android and iOS, and I’ll show you both apps running on emulators. You’ll notice how easy it is to build cross platform apps with Xamarin Forms.

First, create a New Project in Visual Studio and from templates category select Cross-Platform and from templates select Cross Platform App.

This will bring up another dialog where you have to select App type, UI technology, and code sharing strategy. You can select Blank App, Xamarin Forms, and Portable Class Library (PCL) as shown in the screenshot.

Once your solution is created successfully, you’ll notice that it has created four projects. One PCL for cross-platform code, while one for each of the Android, iOS, and UWP apps. Before doing anything else, you need to update your packages from NuGet. For that, right click your solution, select NuGet Package Manager, and then select Xamarin.Forms package and click Install or Update as appropriate in your case.

Now, you need to add code in the MainPage.Xaml file for UI and in MainPage.Xaml.cs for the C# code to run behind the UI. First, I’ll share the XAML for MainPage.Xaml file and then I’ll show you the code for C# file.

This is very simple code just to show you how we can create cross-platform interface and then bind it with the code behind. It shows you a Label, a Text Box and a Button. On clicking button, it shows the message in the label after reading name from the text box. Now, let me show you the running app in Android and iOS.

Android App:

iOS App:

Now, you might have got good idea how to start building cross-platform apps with Xamarin Forms. Try it out and see what you can build from here on. I’ll be back with more examples. The sample project can be downloaded from Github.