xamarin 1 1 1

How to Create your first app in Xamarin.Forms?


This article provides you a basic idea of creating a Xamarin App which will run on Android and iOS. It contains each and every steps required for creating an app using visual studio for windows and macOS.


Basically, Xamarin is a Microsoft owned company started by the engineers who developed Mono for Android, which is cross platform implementation of CLI and CLS. Xamarin is used for developing cross platform apps. It provides same look and feel that native apps offer. It requires good knowledge on c# and XAML(Extensible Application Markup Language). By using XAML, we can create cross platform user interface and c# helps in writing business logics. Windows and macOS both operating system supports Xamarin, we just need to install Xamarin studio or Visual Studio.

System Prerequisite:

For Windows:

  • Windows 7 or higher
  • Visual Studio 2013 or higher with Xamarin installed

For macOS:

  • Mac OS 10.12 “Sierra” and later
  • Visual studio for Mac with Xamarin installed

This article contains a step by step walkthrough for creating your first xamarin app either using macOS or windows. You can run this app on any platform (Android, iOS and Windows) but there is one restriction that by using macOS you can deploy your app on Android and iOS devices only and by using Windows OS you can deploy your app on Android and Windows devices. This is because to build and deploying the iOS code you need a macOS. For resolving these device specific issues xamarin provide a good support to the simulator, using which, you can use simulator and test your app on various devices. By using the simulator you can build the iOS code from a windows system.

Steps creating a cross platform app:

  • 1) For Windows: Open Visual Studio and click on File -> New -> Project. Under the Visual C# section choose Mobile App(Xamarin.Forms).

For Mac: Open Visual Studio and click on File -> New Solutions. Under the Multiplatform section choose App and then select Blank Form App. As shown in the image below:


  • 2) After clicking on Next button please make sure that both the checkboxes for Android and iOS should be checked and select Use portable class library (.Net Standard)


  • 3) Press Next and your project created successfully.Now you can see three folders in solution explorer
  • xamarin2
  • First folder is for shared code, second one for Android specific code and third for iOS.


  • 4) Right click on the shared folder(DemoApp) and add a page in your project


  • 5) For Windows: From Visual C# Items select Content Page
    For Mac: From Forms section select “Forms ContentPage Xaml”
  • xamarin4


  • 6) Suppose we are adding a content page with name NewMainPage, open NewMainPage.Xaml and under the ContentPage.Content tag write the code given below:
  •  In this code we are adding a Entry control and a Button in NewMainPage.


  • 7) In the NewMainPage.cs add click event of Button:
    void Handle_Clicked(object sender, System.EventArgs e)
    string msg = "Hello " + entryName.Text;
    App.Current.MainPage.DisplayAlert("Message", msg, "OK");
  • 8) For setting NewMainPage as your start page open App.cs are change MainPage there
 MainPage = new NewMainPage();
  • 9) For Running the project on your Android device, Right click on Android folder and Set As Startup project. Similarly for iOS, right click on it and Set As Startup project. For selecting your device click on debug and select a simulator or your device (or From Menu Bar Run -> Start Debugging)Debug on Android:


    • Debug on iOS:


Benefits using Xamarin for Cross-Platform apps

  • 1) Using Xamarin.Forms, you can write core business logic for app which is commonly consumed by Android, iOS and Window platforms. This results saving in good amount of development time for app to be targeted for different platforms, which saves cost eventually.


  • 2) In past, executing mobile apps using Xamarin.Forms at QSS, we observed that using Shared architecture if you write logic in core for one platform then it can be reused up to 65% by other platforms. In case of using PCL architecture, the code reusability is little high and up to 80 – 85%.

About Author:
Author Rashi saini is working in QSS Technosoft as a Xamarin Developer. She has a good experience in Xamarin.Forms(PCL and Shared both) and Xamarin native. She likes to aware with new trends in technology.

About QSS:
QSS Technosoft is leading Xamarin App Development Company developing a cross-platform mobile applications for its esteemed customers. The company has a core competency in developing and delivering Enterprise level Xamarin applications both in Native and Hybrid platforms. The Xamarin competency has experienced and dedicated team of Xamarin developers.

Tags: , , ,

Hire certified


  • Avg. 6+ Years of Experience.
  • Dedicated Resource on Demand.
  • NDA Protected Terms.
  • Start/Interview within 24 Hours.
  • Flexible Engagement Models.
  • Best code practices.
Start Now!


6 Most Important Factors for a Successful Mobile App!

Every precaution that you take in the development process will help you to be effective in building products that will help you grow and reach your goals. Consider these 6 factors before heading for mobile app development.

Subscribe to our newsletter and stay updated