Get started with Xamarin in just 10 minutes

Xamarin.Forms is an open-source UI framework that runs on multiple platforms with a single shared codebase. It allows developers to create user interfaces in XAML with code-behind in C#. These interfaces are rendered as performant native controls on each platform. Check my post here to know more about Xamarin.

Firstly, if you have not installed the Visual Studio, please download and install it from here. During installation, select the Mobile development with .NET workload. If you already have Visual Studio, you can add the Mobile development with .NET workload using the More > Modify option in the Visual Studio Installer.


Visual Studio 2017 or later (Windows or Mac) with the latest Android SDKs configured in Android SDK Manager.

Setting up a Xamarin Forms Project

First of all, let’s start by creating a new Xamarin Forms project by following the below steps.

Certainly, Visual Studio 2019 has more options in the launch view.

  • Clone or check out the code from any repository
  • Open a project or solution
  • Open a local folder from your computer
  • Create a new project.

Create a new Xamarin App

Firstly, let us explore on “Create a new project” in this post.

Project creation Wizard 1

Secondly, filter by Project Type as Mobile and choose the Mobile App (Xamarin.Forms).

Project creation Wizard 2

Now, enter the project name of your wish. Usually, the project and solution name are the same for an app. Choose your preferred location for the project and click “Create“.

Project creation Wizard 3

Select the “Blank” app and target platforms – Android, iOS, and Windows (UWP).

Project creation Wizard 4

Wait for the solution to load. Expand the solution using the Solution Explorer. By default, you can see 4 projects (.NET Standard, Android, iOS, and UWP).

Right-click the project with extension Android and Set as Startup Project. Click the Android Emulator button or press F5.

Configure the Android Emulator

Android Emulator Configuration Wizard

Firstly, click the Create button in the New Device wizard shown above.

Android Emulator Configuration Wizard

Secondly, click the Accept button in the license agreement. This will download the system image required to create an Android Emulator for Pixel 2 device with OS Android 9.0 (API Level 28).

Android Emulator Configuration Wizard

Click the Start button in the Android Device Manager wizard. This will start the Android Emulator to run the app.

Android Emulator

Expand the .NET Standard project and select the XAML page and double-click to open the MainPage.xaml page. You now have a basic Xamarin.Forms app. Press F5 or click the run button to try it out.

Xamarin Forms Getting Started Output

Edit the code

From the menu, select Debug > Stop Debugging.

Open MainPage.xaml and replace the below code inside your ContentPage block.

<StackLayout VerticalOptions="Center">
    <Label Text="Welcome to Xamarin.Forms!" 
            VerticalOptions="Center" />

    <Button Text="Click Me" Clicked="ClickMe_Clicked" />
    <Label x:Name="clickCountLabel" IsVisible="False" />

Open MainPage.xaml.cs and add the following code inside of the class:

int count = 0;
private void ClickMe_Clicked(object sender, EventArgs e)
    clickCountLabel.IsVisible = true;
    clickCountLabel.Text = $"You clicked {count} times.";
Xamarin Forms Getting Started Output

Congratulations, you have successfully built and run your first Xamarin app powered by .NET! Continue building your first Xamarin app with Xamarin.Forms quickstarts.

Thanks for reading. Please share your comments and feedback. Happy Coding…!