After Successfully installing Xamarin Studio on OS X. It's time for the first Hello World Application.
Hello World Application: Xamarin.Forms
What is Xamarin Forms :
Xamarin.Forms is a new library that enables you to build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase. It provides more than 40 cross-platform controls and layouts which are mapped to native controls at runtime, which means that your user interfaces are fully native
Step 1:
Create a new solution.
Step 2: Select Forms App and click Next
Step 3: Add App name and click Next
This is how the project stricture will look like when the solution is created:
App.xaml:
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="HelloXamarinForms.App">
<Application.Resources>
<!-- Application resource dictionary -->
</Application.Resources>
</Application>
App.xaml.cs:
using Xamarin.Forms;
namespace HelloXamarinForms
{
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new HelloXamarinFormsPage();
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
HelloXamarinFormsPage.xaml
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:HelloXamarinForms"
x:Class="HelloXamarinForms.HelloXamarinFormsPage">
<Label Text="Welcome to Xamarin Forms!" VerticalOptions="Center"
HorizontalOptions="Center" />
</ContentPage>
HelloXamarinFormsPage.xaml.cs
using Xamarin.Forms;
namespace HelloXamarinForms
{
public partial class HelloXamarinFormsPage : ContentPage
{
public HelloXamarinFormsPage()
{
InitializeComponent();
}
}
}