Introduction to Xamarin Forms

For the longest time, developers have dreamed to write one set of code to support multiple application platforms. PhoneGap was one product that achieved that dream; it only had one caveat: it isn’t native. PhoneGap runs within the operating system’s browser, essentially making it a localized web application. It’s certainly a valid option for developing mobile applications.

When it comes to Xamarin, the iOS and Android interfaces were separate, but code sharing could occur between the backend code, by using PCL’s, shared projects, or code linking. Either way, most of the code was separated, but only the UI code was differentiated.

In comes Xamarin Forms 3.0, a new way to share 100% of the code. Xamarin forms offers an API for building applications using pages or views. For instance, below is a sample page that works in both iOS and Android:

var page = new ContentPage {
    Title = "My Profile",
    Icon = "MyProfile.png",
    Content = new StackLayout {
        Spacing = 15, Padding = 25,
        VerticalOptions = LayoutOptions.Center,
        Children = {
            new Entry { Placeholder = "Name" },
            new Entry { Placeholder = "Address" },
            new Entry { Placeholder = "City/State" },
            new Button {
                Text = "Save",
                TextColor = Color.Black,
                BackgroundColor = Color.White }}}
};

Additionally, Xamarin Forms has content views that use a XAML interface with an associated code-behind, giving a WPF feel to application development. With this approach, you can create 100% SHARED CODE, a remarkable achievement. To get an idea of what Xamarin Forms can do, check out the online samples.

I plan to continue to write more about Xamarin Forms in the year to come. Stay tuned.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s