Xamarin.Forms

Build native UIs for iOS, Android and Windows
from a single, shared C# codebase.

Use the Xamarin.Forms API to quickly build native apps for iOS, Android and Windows completely in C#.
We built the above CRM app with Xamarin.Forms with over 90% code sharing across platforms.

Show me the code.

If you know C#, you already know how to build iOS, Android, and Windows apps.

1

Author your UI in C# or XAML. Xamarin.Forms pages represent single screens within an app. Pages contain layouts, buttons, labels, lists, and other common controls. Connect these controls to shared backend code and you get fully native iOS, Android, and Windows Phone apps built entirely with shared C#.

using Xamarin.Forms;

var profilePage = new ContentPage {
    Title = "Profile",
    Icon = "Profile.png",
    Content = new StackLayout {
        Spacing = 20, Padding = 50,
        VerticalOptions = LayoutOptions.Center,
        Children = {
            new Entry { Placeholder = "Username" },
            new Entry { Placeholder = "Password", IsPassword = true },
            new Button {
                Text = "Login",
                TextColor = Color.White,
                BackgroundColor = Color.FromHex("77D065") }}}
};

var settingsPage = new ContentPage {
    Title = "Settings",
    Icon = "Settings.png",
    (...)
};

var mainPage = new TabbedPage { Children = { profilePage, settingsPage } };
<?xml version="1.0" encoding="UTF-8"?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            x:Class="MyApp.MainPage">
    <TabbedPage.Children>
        <ContentPage Title="Profile" Icon="Profile.png">
            <StackLayout Spacing="20" Padding="20"
                         VerticalOptions="Center">
                <Entry Placeholder="Username"
                       Text="{Binding Username}"/>
                <Entry Placeholder="Password"
                       Text="{Binding Password}"
                       IsPassword="true"/>
                <Button Text="Login" TextColor="White"
                        BackgroundColor="#77D065"
                        Command="{Binding LoginCommand}"/>
            </StackLayout>
        </ContentPage>
        <ContentPage Title="Settings" Icon="Settings.png">
            <!-- Settings -->
        </ContentPage>
    </TabbedPage.Children>
</TabbedPage>

2

At runtime, each page and its controls are mapped to platform-specific native user interface elements; for example, a Xamarin.Forms Entry becomes a UITextView on iOS, an EditText on Android, and a TextBox on Windows.

Take full advantage of each platform.

Create custom views.

Create platform-specific views built with Xamarin.iOS or Xamarin.Android to customize the user interface on each platform.

Call platform APIs via shared services.

Need device-level functionality? Use Xamarin.iOS and Xamarin.Android or use Xamarin.Forms services that abstract platform-specific APIs.

Choose markup or code.

Use code or markup to build a beautiful UI with data-binding and styles, using either C# or XAML markup.

Which Xamarin approach is best for your app?

Xamarin.Forms

Xamarin.Forms is best for:

  • Data entry apps
  • Prototypes and proofs-of-concept
  • Apps that require little platform-specific functionality
  • Apps where code sharing is more important than custom UI
Xamarin Platform

Xamarin.iOS & Xamarin.Android are best for:

  • Apps that require specialized interactions
  • Apps with highly polished design
  • Apps that use many platform-specific APIs
  • Apps where custom UI is more important than code sharing

What’s in the box.

Pages

  • ContentPage
  • MasterDetailPage
  • NavigationPage
  • TabbedPage
  • CarouselPage

Layouts


Controls

  • ActivityIndicator
  • BoxView
  • Button
  • DatePicker
  • Editor
  • Entry
  • Image
  • Label
  • ListView
  • Map
  • OpenGLView
  • Picker
  • ProgressBar
  • SearchBar
  • Slider
  • Stepper
  • TableView
  • TimePicker
  • WebView
  • EntryCell
  • ImageCell
  • SwitchCell
  • TextCell
  • ViewCell

Extend Xamarin.Forms with custom controls.

  • Define your own controls, layouts, pages and cells.
  • Expose your own platform-specific controls in Xamarin.Forms pages.
  • Subclass included controls and customize their behavior.

Build pages entirely with XAML.

  • Define views, layouts and bindings in a succinct markup language.
  • Note: Xamarin.Forms is not compatible with pre-existing XAML visual designers.

Architect with MVVM and data bindings.

  • MVVM architecture for clean separation of UI and app logic.
  • Two-way data bindings automatically sync data between controls and models.
  • Mobile-optimized dependency injection with <10ms startup time.
  • Messaging center for loosely-coupled messaging between app components.

Weave captivating animations.

  • Basic animations (e.g. rotate, fade, scale) which can be composed to build complex effects.
  • Low-level animation API for building custom, replayable animations.
  • All operations delegate to platform-specific animation APIs (e.g. CoreAnimation on iOS) for optimal performance.
  • Animations are awaitable using async/await for developer-friendly sequencing.

Tap into our growing Xamarin.Forms ecosystem.

Design your own functionality or discover a visually striking pre-built component. Our partners have rewritten over 140 components so you can use the Xamarin.Forms API to easily build cross-platform apps entirely in C#.

Watch the video

Build a native app for three platforms today.

Xamarin.Forms comes with Xamarin Platform.

Download now