Xamarin Samples

ButtonXaml

This program demonstrates how to create a Button in XAML and process events from it in the code-behind file. By default, the Button occupies the entire page.

ButtonCode

This program demonstrates how to create a Button in code and process events from it. By default, the Button occupies the entire page.

BasicStyles

Xamarin.Forms applications often contain multiple controls that have an identical appearance.

Setting the appearance of each individual control can be repetitive and error prone.

Instead, styles can be created that customize control appearance by grouping and settings properties available on the control type.

This sample demonstrates using the Style class to create styles.

Modal

This sample demonstrates how to navigate to modal pages.

ScaleAndRotate

The Xamarin.Forms Scale and Rotation properties allow a program to scale and rotate Xamarin.Forms visual elements.

BoxViewClock

A classic analog clock realized entirely with BoxView.

 

DynamicUnevenListCells

This sample demonstrates using the `Cell.ForceUpdateSize` method to programmatically resize a `ListView` row at runtime.

CoerceValueCallback

A bindable property is a special type of property, where the property's value is tracked by the Xamarin.Forms property system. This sample demonstrates using a coerce value callback to force a re-evaluation of a bindable property when the value of the property changes.

DataTemplateSelector

This sample demonstrates using a DataTemplateSelector to select a DataTemplate at runtime per item in a ListView.

DynamicStyles

This sample demonstrates how to use dynamic resources to make applications respond to style changes dynamically at runtime.

EffectBehavior

Behaviors are a useful approach for adding an effect to a control, removing boiler-plate effect handling code from code-behind files. This sample demonstrates using a behavior to add an effect to a control.

  

PassingData

This sample demonstrates how to pass data between pages when navigating.

PanGesture

This sample demonstrates using the `PanGestureRecognizer` class to implement dragging.
Presented image (1024x768 px) is smaller than these presented in screenshots from other platforms. This is caused by larger screen resolution in target on which app was tested (1280x720).

PinchGesture

This sample demonstrates using the `PinchGestureRecognizer` class to implement interactive zoom functionality.

    

TapGesture

This sample demonstrates using the `TapGestureRecognizer` class to implement tap gesture recognition.

TabbedPage

This sample demonstrates how to use a `TabbedPage` to navigate through a collection of pages. The `TabbedPage` is constructed by assigning a collection to the `ItemsSource` property and assigning a `DataTemplate` to the `ItemTemplate` property to return pages for objects in the collection.

TabbedPageWithNavigationPage

This sample demonstrates how embed a `NavigationPage` in a `TabbedPage`, in order to perform page navigation within a tab. The `TabbedPage` is constructed by populating it with a collection of child `Page` objects.

EventToCommandBehavior

This sample demonstrates using a Xamarin.Forms behavior to invoke a command when an event fires.

Hierarchical

This sample demonstrates how to perform hierarchical navigation through a stack of pages in Xamarin.Forms.

LoginFlow

This sample demonstrates how to manipulate the navigation stack in order to only display the main page of the application once the user has successfully logged in.

  

SimpleTheme

This sample demonstrates using a ControlTemplate to theme a ContentPage and change the theme at runtime.

 

SimpleThemeWithTemplateBinding

This sample demonstrates using a ControlTemplate with a TemplateBinding to theme a ContentPage and change the theme at runtime.

  

SimpleThemeWithTemplateBindingAndViewModel

This sample demonstrates using a ControlTemplate with a TemplateBinding, that in turn binds to a ViewModel, to theme a ContentPage and change the theme at runtime.

FormsGridLayout

This sample demonstrates how to display various ui elements in a grid.

UserInterface/Animation/Basic

The ViewExtensions class provides extension methods that can be used to construct simple animations. This sample demonstrates creating and canceling animations using the ViewExtensions class.

Effects/ShadowEffectRuntimeChange

This sample demonstrates using attached properties to pass parameters to an effect, and changing a parameter at runtime.

GettingStarted/XamarinFormsXamlSample

This sample demonstrates sharing C# code across platforms using Xamarin.Forms.

LabelledSectionsList

This sample demonstrates how to create an alphabetically ordered list with labelled sections.

      

UserInterface/ListView/BuiltInCells/builtInCellsListView

Built-In Cells:

  • TextCell
  • ImageCell
  • SwitchCell
  • EntryCell

 

UserInterface/ListView/Grouping/groupingSampleListView

This sample demonstrates how to implement grouping in a ListView, using both XAML and C#.

UserInterface/ShadowPlatformSpecific

This sample demonstrates how to expose an Effect through a platform-specific.

WorkingWithTriggers 

Example of using Xamarin triggers for view customization.

XAML/PassingConstructorArguments 

This sample demonstrates specifying constructor arguments for a non-default constructor in XAML.

XAML/ValidationCallback

A bindable property is a special type of property, where the property's value is tracked by the Xamarin.Forms property system. This sample demonstrates using a validation callback to validate the value of a bindable property.

Navigation/Pop-ups

This sample demonstrates using the alert and action sheet APIs to ask users simple questions and guide users through tasks.

SolitaireEncryption

This sample illustrates the inclusion of a Unit Test project in a Xamarin.Forms solution and also a custom Button renderer.

UserInterface/Animation/Easing

This sample demonstrates how to consume the pre-defined easing functions, and how to create custom easing functions.

BasicFormsListView

This sample demonstrates basic use of ListView populated with just an array of strings, using the default view.

CallingFactoryMethods

s sample demonstrates using XAML to call a factory method that can be used to initialize an object.

CustomRenderer.ViewCell

This sample demonstrates a custom renderer that encapsulates platform-specific list controls and native cell layouts.

HelloXamarinFormsWorld

The application demonstrates Xamarin Forms.

HelloXamarinFormsWorldXaml

The application demonstrates Xamarin Forms.

Template/DataTemplates

This sample demonstrates creating a DataTemplate to specify the appearance of data being displayed by a ListView.

WorkingWithListView

These samples relate to the Working with ListView in Xamarin.Forms doc.

UserInterface/ListView/BindingContextChanged

This sample demonstrates binding context changes in a ListView custom cell in Xamarin.Forms.

Behaviors/AttachedNumericValidationBehavior

This sample demonstrates creating and consuming an attached behavior. A behavior that's attached to a control through attached properties is known as an attached behavior.

UserInterface/ListView/Interactivity/InteractivityListView

This sample demonstrates how to implement interactivity in ListView. Implementations for XAML and C# provided.

* Context Actions * Pull-to-Refresh * Taps * Selection

GettingStarted/XamarinFormsSample

This sample demonstrates sharing C# code across platforms using Xamarin.Forms.

PhonewordMultiscreen

This sample demonstrates adding simple page navigation to the Phoneword app using Xamarin.Forms. The app functionality is to convert telephone number 'words' into digits (eg 1-800-FLOWERS to the actual phone number), and display a second page containing a list of phone numbers that have been called from the app.

    

UserInterface/TableView/TableViewSamples

The app consists of several tabs. There are four tabs with identical tables, with each demonstrating a different TableIntent. There is one tab demonstrating the customization options of EntryCell. Another tab demonstrates SwitchCell.

WorkingWithFiles/PCL

These samples relate to the Working with Files in Xamarin.Forms doc.

WorkingWithNavigation

This sample demonstrate navigation using Xamarin.Forms.

WorkingWithStyles

These samples relate to the Working with Files in Xamarin.Forms doc.

WorkingWithColors

This example presents the Xamarins Color class.

WorkingWithFonts

This sample shows how Xamarin.Forms lets you specify font attributes (including weight and size) on controls that display text.

TipCalc

TipCalc lets you type in a food-and-drink subtotal and a post-tax total from your restaurant bill and then select a tip percentage. It applies the percentage to the food-and-drink subtotal and adds the result to the post-tax total, rounded to the nearest quarter.

ClassHierarchy

This program uses .NET reflection to display a scrollable hierarchy of all Xamarin.Forms classes, structures, and enumerations. Non-instantiable classes are displayed in the system accent color.

ListView TwoWayBinding

This sample demonstrates how to implement data collection using EntryCell and ViewCell in Xamarin.Forms. Implementations for XAML and C# provided.