Xamarin.Forms Namespace

Cross-platform, natively-backed UI toolkit.

Classes

AbsoluteLayout

Positions child elements at absolute positions.

Accelerator

Represents a shortcut key for a MenuItem.

AcceleratorTypeConverter

Class that the XAML parser uses to convert strings to Accelerator objects.

ActivityIndicator

A visual control used to indicate that something is ongoing.

Animation

Encapsulates an animation, a collection of functions that modify properties over a user-perceptible time period.

AnimationExtensions

Extension methods for IAnimatable objects.

Application

Class that represents a cross-platform mobile application.

AppLinkEntry

A deep application link in an app link search index.

AutomationProperties

Contains both abbreviated and detailed UI information that is supplied to accessibility services.

BackButtonPressedEventArgs

Internal use only. Contains arguments for the event that is raised when a back button is pressed.

BaseMenuItem

Base class for menu items.

Behavior

Base class for generalized user-defined behaviors that can respond to arbitrary conditions and events.

Behavior<T>

Base generic class for generalized user-defined behaviors that can respond to arbitrary conditions and events.

BindableObject

Provides a mechanism by which application developers can propagate changes that are made to data in one object to another, by enabling validation, type coercion, and an event system. BindableProperty.

BindableObjectExtensions

Contains convenience extension methods for BindableObject.

BindableProperty

A BindableProperty is a backing store for properties allowing bindings on BindableObject.

BindablePropertyConverter

A TypeConverter for bindable properties.

BindablePropertyKey

The secret key to a BindableProperty, used to implement a BindableProperty with restricted write access.

Binding

A single 1:1 immutable data binding.

BindingBase

An abstract class that provides a BindingMode and a formatting option.

BindingCondition

Class that represents a value comparison with the target of an arbitrary binding.

BindingTypeConverter

Type converter that converts from strings to Binding objects.

BoundsConstraint

A bounds layout constraint used by RelativeLayouts.

BoundsTypeConverter

A TypeConverter that converts strings into Rectangles for use with AbsoluteLayouts.

BoxView

A View used to draw a solid colored rectangle.

Button

A button View that reacts to touch events.

Button.ButtonContentLayout

Controls the relative positioning of, and spacing between, text and an image on a Button.

Button.ButtonContentTypeConverter

Class that the XAML parser uses to convert strings to Xamarin.Forms.Button ButtonContentLayout objects.

CarouselPage

A Page that users can swipe from side to side to display pages of content, like a gallery.

Cell

Provides base class and capabilities for all Xamarin.Forms cells. Cells are elements meant to be added to ListView or TableView.

ClickedEventArgs

Event arguments for a click event.

ClickGestureRecognizer

Recognizer for click gestures.

ColorTypeConverter

A TypeConverter that converts from strings to a Color.

ColumnDefinition

An IDefinition that defines properties for a column in a Grid.

ColumnDefinitionCollection

A DefinitionCollection<T> for ColumnDefinitions.

Command

Defines an ICommand implementation that wraps a Action.

Command<T>

Defines an ICommand implementation wrapping a generic Action<T>.

CompressedLayout

Contains attached properties for omitting redundant renderers.

Condition

Base class for conditions.

Configuration<TPlatform,TElement>

Utility class for retrieving platform-specific versions of elements.

Constraint

A layout constraint used by RelativeLayouts.

ConstraintExpression

Defines a constraint relationship.

ConstraintTypeConverter

A TypeConverter that converts from strings to a Constraint.

ContentPage

A Page that displays a single view.

ContentPresenter

Layout manager for templated views.

ContentPropertyAttribute

Indicates the property of the type that is the (default) content property.

ContentView

An element that contains a single child element.

ControlTemplate

Template that specifies a group of styles and effects for controls.

DataTemplate

A template for multiple bindings, commonly used by ListViews and Xamarin.Forms.MultiPages.

DataTemplateSelector

Selects DataTemplate objects by data type and container.

DataTrigger

Class that represents a condition on an arbitrary binding, along with a list of Setter objects that will be applied when the condition is met.

DateChangedEventArgs

Event arguments for DateSelected event.

DatePicker

A View that allows date picking.

DefinitionCollection<T>

A collection parameterized by an IDefinition. Base class for ColumnDefinitionCollection and RowDefinitionCollection.

DependencyAttribute

An attribute that indicates that the specified type provides a concrete implementation of a needed interface.

DependencyService

Static class that provides the Xamarin.Forms.DependencyService.Get{T} factory method for retrieving platform-specific implementations of the specified type T.

DesignMode

Static class that developers can use to determine if the application is running in a previewer.

Device

A utility class to interact with the current Device/Platform.

Device.Styles

Class that exposes device-specific styles as static fields.

Easing

Functions that modify values non-linearly, generally used for animations.

Editor

A control that can edit multiple lines of text.

Effect

A collection of styles and properties that can be added to an element at run time.

EffectiveFlowDirectionExtensions

Extension methods for finding out the flow direction and whether it was explicitly set.

Element

Provides the base class for all Xamarin.Forms hierarchal elements. This class contains all the methods and properties required to represent an element in the Xamarin.Forms hierarchy.

ElementEventArgs

Provides data for events pertaining to a single Element.

ElementTemplate

Base class for DataTemplate and ControlTemplate classes.

Entry

A control that can edit a single line of text.

EntryCell

A Cell with a label and a single line text entry field.

EventTrigger

Class that represents a triggering event and a list of TriggerAction objects that will be invoked when the event is raised.

ExportEffectAttribute

Attribute that identifies a Effect with a unique identifier that can be used with Xamarin.Forms.Effect.Resolve to locate an effect.

FileImageSource

An ImageSource that reads an image from a file.

FileImageSourceConverter

A TypeConverter that converts to FileImageSource.

FlexAlignContentTypeConverter

Converts a string representation of a child content row alignment style to a FlexAlignContent.

FlexAlignItemsTypeConverter

Converts a string representation of a child content alignment style to a FlexAlignItems.

FlexAlignSelfTypeConverter

Converts a string representation of an alignment override to a FlexAlignSelf.

FlexBasis.FlexBasisTypeConverter

Converts a string representation of a flex basis to a FlexBasis.

FlexDirectionTypeConverter

Converts a string representation of a row or column flex layout direction to a FlexDirection.

FlexJustifyTypeConverter

Converts a string representation of a child element justification style to a FlexJustify.

FlexLayout

A Flexbox-like layout that lays out child elements in optionally wrappable rows or columns of child elements.

FlexWrapTypeConverter

Converts a string representation of a wrapping style to a FlexWrap.

FlowDirectionConverter

Converts a string representation of a flow direction to a FlowDirection.

FocusEventArgs

Event args for VisualElement's Focused and Unfocused events.

FontSizeConverter

Converts a string into a font size.

FontTypeConverter

A TypeConverter that converts from strings to Xamarin.Forms.Core.Font.

FormattedString

Represents a text with attributes applied to some parts.

Frame

An element containing a single child, with some framing options.

GestureRecognizer

The base class for all gesture recognizers.

Grid

A layout that arranges views in rows and columns.

GridLengthTypeConverter

A TypeConverter that converts from strings to GridLengths.

HandlerAttribute

An abstract attribute whose subclasses specify the platform-specific renderers for Xamarin.Forms abstract controls.

HtmlWebViewSource

A WebViewSource bound to an HTML-formatted string.

Image

View that holds an image.

ImageCell

A TextCell that has an image.

ImageSource

Abstract class whose implementors load images from files or the Web.

ImageSourceConverter

Class that takes a string representation of an image file location and returns a ImageSource from the specified resource.

InputView

The base class of a view which can take keyboard input.

ItemsView<TVisual>

A base class for a view that contains a templated list of items.

ItemTappedEventArgs

Event arguments for the ItemTapped event.

ItemVisibilityEventArgs

Event args when an items visiblity has been changed in a ListView.

Keyboard

Default keyboard and base class for specialized keyboards, such as those for telephone numbers, email, and URLs.

KeyboardTypeConverter

A TypeConverter that converts a string into a Keyboard.

Label

A View that displays text.

Layout

Provides the base class for all Layout elements. Use Layout elements to position and size child elements in Xamarin.Forms applications.

Layout<T>

A base implementation of a layout with undefined behavior and multiple children.

LayoutOptionsConverter

Class that takes a string representation of a LayoutOptions and returns a corresponding LayoutOptions.

ListStringTypeConverter

Type converter for converting properly formatted string lists to lists.

ListView

An Xamarin.Forms.ItemsView{TVisual} that displays a collection of data as a vertical list.

MasterDetailPage

A Page that manages two panes of information: A master page that presents data at a high level, and a detail page that displays low-level details about information in the master.

Menu

Represents an application menu on platforms that support them.

MenuItem

Class that presents a menu item and associates it with a command.

MessagingCenter

Associates a callback on subscribers with a specific message name.

ModalEventArgs

Base class for ModalPushedEventArgs, ModalPushingEventArgs, ModalPoppedEventArgs, and ModalPoppingEventArgs.

ModalPoppedEventArgs

Arguments for the event that is raised when a modal window is popped from the navigation stack.

ModalPoppingEventArgs

Arguments for the event that is raised when a modal window is popping from the navigation stack.

ModalPushedEventArgs

Arguments for the event that is raised when a modal window is pushed onto the navigation stack.

ModalPushingEventArgs

Arguments for the event that is raised when a modal window is being pushed onto the navigation stack.

MultiPage<T>

A bindable, templatable base class for pages which contain multiple sub-pages.

MultiTrigger

Class that represents a list of property and binding conditions, and a list of setters that are applied when all of the conditions in the list are met.

NameScopeExtensions

Extension methods for Element and Xamarin.Forms.INameScope that add strongly-typed FindByName methods.

NavigationEventArgs

EventArgs for the NavigationPage's navigation events.

NavigationPage

A Page that manages the navigation and user-experience of a stack of other pages.

On

Class that is used within OnPlatform tags in XAML when specifying values on platforms.

OnIdiom<T>

Provides idiom-specific implementation of T for the current target idiom.

OnPlatform<T>

Provides the platform-specific implementation of T for the current OS.

OpenGLView

A View that displays OpenGL content.

Page

A VisualElement that occupies the entire screen.

PanGestureRecognizer

A gesture recognizer for panning content that is larger than its parent view.

PanUpdatedEventArgs

Event that is raised when a pan gesture updates.

Picker

A View control for picking an element in a list.

PinchGestureRecognizer

Recognizer for pinch gestures.

PinchGestureUpdatedEventArgs

Event arguments for the PinchUpdated event.

PlatformEffect<TContainer,TControl>

Base class for platform-specific effect classes.

PointTypeConverter

A TypeConverter that converts from a string to a Point.

PoppedToRootEventArgs

EventArgs for the NavigationPage's PoppedToRoot navigation event.

ProgressBar

A View control that displays progress.

PropertyChangingEventArgs

Event arguments for the PropertyChangingEventHandler delegate.

PropertyCondition

Class that represents a value comparison against a property on the control that contains the enclosing MultiTrigger.

RectangleTypeConverter

A TypeConverter that converts a string to a Rectangle.

ReferenceTypeConverter

For internal use by the Xamarin.Forms platform.

RelativeLayout

A Layout<T> that uses Constraints to layout its children.

RenderWithAttribute

Associate view with renderer.

ResolutionGroupNameAttribute

Attribute that identifies a group name, typically a company name or reversed company URL, that provides a scope for effect names.

ResourceDictionary

An IDictionary that maps identifier strings to arbitrary resource objects.

ResourceDictionary.RDSourceTypeConverter

For internal use by the Xamarin.Forms platform.

RoutingEffect

Platform-independent effect that wraps an inner effect, which is usually platform-specific.

RowDefinition

An IDefinition that defines properties for a row in a Grid.

RowDefinitionCollection

A DefinitionCollection<T> for RowDefinitions.

ScrolledEventArgs

Arguments for the event that is raised when a window is scrolled.

ScrollToRequestedEventArgs

Arguments for the event that is raised when a scroll is requested.

ScrollView

An element capable of scrolling if its Content requires.

SelectedItemChangedEventArgs

Event arguments for the ItemSelected event.

SelectedPositionChangedEventArgs

Event arguments for positional scrolling events.

Setter

Represents an assignment of a property to a value, typically in a style or in response to a trigger.

SettersExtensions

Defines extensions methods for IList<Setter>

Slider

A View control that inputs a linear value.

Span

Represents a part of a FormattedString.

StackLayout

A Layout<T> that positions child elements in a single line which can be oriented vertically or horizontally.

Stepper

A View control that inputs a discrete value, constrained to a range.

StreamImageSource

ImageSource that loads an image from a Stream.

Style

Class that contains triggers, setters, and behaviors that completely or partially define the appearance and behavior of a class of visual elements.

Switch

A View control that provides a toggled value.

SwitchCell

A Cell with a label and an on/off switch.

TabbedPage

MultiPage<T> that displays an array of tabs across the top of the screen, each of which loads content onto the screen.

TableRoot

A TableSection that contains either a table section or the entire table.

TableSection

A logical and visible section of a TableView.

TableSectionBase

Abstract base class defining a table section.

TableSectionBase<T>

Table section that contains instances of type T that are rendered by Xamarin.Forms.

TableView

A View that holds rows of Cell elements.

TapGestureRecognizer

Provides tap gesture recognition and events.

TappedEventArgs

Arguments for the Xamarin.Forms.TappedEvent event.

TemplateBinding

Binds a template property to the parent of the view that owns a ControlTemplate.

TemplatedPage

A page that displays full-screen content with a control template, and the base class for ContentPage.

TemplatedView

A view that displays content with a control template, and the base class for ContentView.

TemplateExtensions

Extension class for DataTemplate, providing a string-based shortcut method for defining a Binding.

TextAlignmentConverter

Converts a string representation of a text alignment to a TextAlignment.

TextCell

A Cell with primary Text and Detail text.

TextChangedEventArgs

Event arguments for TextChanged events. Provides old and new text values.

ThicknessTypeConverter

A TypeConverter that converts from a string to a Thickness.

TimePicker

A View control that provides time picking.

ToggledEventArgs

Event arguments for Toggled and OnChanged events.

ToolbarItem

An item in a toolbar or displayed on a Page.

Trigger

Class that represents a property condition and an action that is performed when the condition is met.

TriggerAction

A base class for user-defined actions that are performed when a trigger condition is met.

TriggerAction<T>

A generic base class for user-defined actions that are performed when a trigger condition is met.

TriggerBase

Base class for classes that contain a condition and a list of actions to perform when the condition is met.

TypeConverter

Abstract base class whose subclasses can convert values between different types.

TypeConverterAttribute

Attribute that specifies the type of TypeConverter used by its target.

TypeTypeConverter

Class that takes a string representation of a Type and returns a corresponding Type.

UnsolvableConstraintsException

Exception indicating that the Constraints specified cannot be simultaneously satisfied.

UriImageSource

An ImageSource that loads an image from a URI, caching the result.

UriTypeConverter

A TypeConverter that converts from a string or Uri to a Uri.

UrlWebViewSource

A WebViewSource bound to a URL.

ValueChangedEventArgs

Event arguments for ValueChanged events. Provides both old and new values.

View

A visual element that is used to place layouts and controls on the screen.

ViewCell

A Cell containing a developer-defined View.

ViewExtensions

Extension methods for Views, providing animatable scaling, rotation, and layout functions.

VisualElement

A Element that occupies an area on the screen, has a visual appearance, and can obtain touch input.

VisualElement.FocusRequestArgs

Contains event arguments for the FocusChangeRequested event.

VisualElement.VisibilityConverter

Converts a string representation of a visual element visibility to a Boolean that represents the visibility of the element.

VisualState

Contains a named visual state that applies a list of setters to an element in order to correlate a state with an appearance.

VisualStateGroup

Contains a list of related visual states that can be applied to a visual element.

VisualStateGroupList

Contains a list of visual state groups for an application.

VisualStateManager

Manages visual state groups and transitions controls between states.

WebNavigatedEventArgs

Class that contains arguments for the event that is raised after web navigation completes.

WebNavigatingEventArgs

Class that contains arguments for the event that is raised after web navigation begins.

WebNavigationEventArgs

TClass that contains arguments for the event that is when web navigation begins.

WebView

A View that presents HTML content.

WebViewSource

Abstract class whose subclasses provide the data for a WebView.

WebViewSourceTypeConverter

A TypeConverter that converts a string to a UrlWebViewSource.

Structs

Color

Class that represents a color and exposes it as RGBA and HSL values.

FlexBasis

Struct that represents an absolute or relative element size.

Font

The font used to display text.

GridLength

Used to define the size (width/height) of Grid ColumnDefinition and RowDefinition.

LayoutOptions

A struct whose static members define various alignment and expansion options.

Point

Struct defining a 2-D point as a pair of doubles.

Rectangle

Struct defining a rectangle, using doubles.

Size

Struct defining height and width as a pair of doubles.

SizeRequest

Struct that defines minimum and maximum Sizes.

Thickness

Struct defining thickness around the edges of a Rectangle using doubles.

Vec2

Struct defining X and Y double values.

Interfaces

AbsoluteLayout.IAbsoluteList<T>

List interface with overloads for adding elements to an absolute layout.

Grid.IGridList<T>

List interface with overloads for adding elements to a grid.

IAnimatable

Defines an interface for elements that can be animated.

IAppIndexingProvider

This interface is for internal use by platform renderers.

IApplicationController

For internal use by platform renderers.

IAppLinkEntry

Interface that represents a deep application link in an app link search index.

IButtonController

For internal use by platform renderers.

ICellController

For internal use by platform renderers.

IConfigElement<T>

This interface is for internal use by platform renderers.

IConfigPlatform

Base interface for marker classes that identify target platforms for platform specific effects.

IDefinition

Interface defining the type of RowDefinition and ColumnDefinition.

IEditorController

For internal use by platform renderers.

IEffectControlProvider

When implemented in a renderer, registers a platform-specific effect on an element.

IElementConfiguration<TElement>

Interface for returning the platform-specific instance of a Xamarin.Forms type.

IElementController

For internal use by platform renderers.

IEntryCellController

For internal use by platform renderers.

IEntryController

For internal use by platform renderers.

IExtendedTypeConverter

Base class for type converters.

IGestureRecognizer

The base interface all gesture recognizers must implement.

IGridController

For internal use by platform renderers.

IImageController

For internal use by platform renderers.

IItemsView<T>

This interface is for internal use by platform renderers.

IItemViewController

For internal use by platform renderers.

ILayout

Interface indicating layout behavior and exposing the LayoutChanged event.

ILayoutController

For internal use by platform renderers.

IListProxy

This interface is for internal use by platform renderers.

IListViewController

For internal use by platform renderers.

IMasterDetailPageController

For internal use by platform renderers.

IMenuItemController

For internal use by platform renderers.

IMessagingCenter

Enables view models and other components to communicate by adhering to a message contract.

IMultiPageController<T>

Base class for multipage controllers.

INativeElementView

Interface that contains a read-only property that returns the platform-specific native view for a Xamarin.Forms element.

INavigation

Interface abstracting platform-specific navigation.

INavigationMenuController

For internal use by platform renderers.

INavigationPageController

For internal use by platform renderers.

IOpenGlViewController

For internal use by platform renderers.

IPageContainer<T>

Interface defining a container for Pages and exposing a CurrentPage property.

IPageController

For internal use by platform renderers.

IPanGestureController

For internal use by platform renderers.

IPinchGestureController

For internal use by platform renderers.

IPlatformElementConfiguration<TPlatform,TElement>

Marker interface for returning platform-specific configuration elements.

IRegisterable

Internally-used flagging interface indicating types that can be registered with Xamarin.Forms.Registrar.

IScrollViewController

For internal use by platform renderers.

ISearchBarController

For internal use by platform renderers.

IStreamImageSource

This interface is for internal use by platform renderers.

ITableModel

This interface is for internal use by platform renderers.

ITableViewController

For internal use by platform renderers.

ITemplatedItemsList<TItem>

This interface is for internal use by platform renderers.

ITemplatedItemsListScrollToRequestedEventArgs

This interface is for internal use by platform renderers.

ITemplatedItemsView<TItem>

This interface is for internal use by platform renderers.

IValueConverter

Interface defining methods for two-way value conversion between types.

IViewContainer<T>

The type of element that can be added to the container.

IViewController

This interface is for internal use by platform renderers.

IVisualElementController

For internal use by platform renderers.

IWebViewController

For internal use by platform renderers.

IWebViewDelegate

This interface is for internal use by platform renderers.

RelativeLayout.IRelativeList<T>

An IList<T> of Views used by a RelativeLayout.

Enums

AbsoluteLayoutFlags

Flags used to modify how layout bounds are interpreted in an AbsoluteLayout.

Aspect

Defines how an image is displayed.

BindingMode

The direction of changes propagation for bindings.

Button.ButtonContentLayout.ImagePosition

Enumerates image locations within a button.

ButtonsMask

Flag values that represent mouse buttons.

ConstraintType

Enumeration specifying whether a constraint is constant, relative to a view, or relative to its parent.

DependencyFetchTarget

Enumeration specifying whether Xamarin.Forms.DependencyService.Get should return a reference to a global or new instance.

EffectiveFlowDirection

Enumerates flags that indicate whether the layout direction was explicitly set, and whether the layout direction is right-to-left.

FlexAlignContent

Enumerates values that control how multiple rows or columns of child elements are aligned.

FlexAlignItems

Enumerates values that control the alignment of child elements.

FlexAlignSelf

Enumerates values that control how and whether a child element overrides alignment attributes applied by its parent.

FlexDirection

Enumerates values that specify row and columen flex layout directions, relative to the directions for the device locale.

FlexJustify

Enumerates values that describe how child elements are justified when there is extra space around them.

FlexPosition

Enumerates values that control how layout coordinates are interpreted when specifying the positions of child elements.

FlexWrap

Enumerates values that control whether and how to wrap items in a FlexLayout.

FlowDirection

Enumerates values that control the layout direction for views.

FontAttributes

Enumerates values that describe font styles.

GestureState

Enumeration specifying the various states of a gesture.

GestureStatus

Enumerates possible gesture states.

GridUnitType

Enumerates values that control how the Value property is interpreted for row and column definitions.

KeyboardFlags

Flagging enumeration for Keyboard options such as Capitalization, Spellcheck, and Suggestions.

LayoutAlignment

Values that represent LayoutAlignment.

LineBreakMode

Enumeration specifying various options for line breaking.

ListViewCachingStrategy

Enumerates caching strategies for a ListView.

MasterBehavior

Enumerates values that control how detail content is displayed in a master-detail page.

MeasureFlags

Enumerates values that tell whether margins are included when laying out windows.

NamedSize

Represents pre-defined font sizes.

ScrollOrientation

Enumeration specifying vertical or horizontal scrolling directions.

ScrollToMode

Enumerates values that describe how a scroll request is made.

ScrollToPosition

Enumerates values that describe a scroll request.

SeparatorVisibility

Enumerates values that control the visibility of list item separators.

StackOrientation

The orientations the a StackLayout can have.

TableIntent

TableIntent provides hints to the renderer about how a table will be used.

TabsStyle

Enumerates tab styles for tabbed pages.

TargetIdiom

Indicates the type of device Xamarin.Forms is working on.

TargetPlatform

Indicates the kind of OS Xamarin.Forms is currently working on.

TextAlignment

Enumerates values that control text alignment.

ToolbarItemOrder

Enumeration specifying whether the ToolbarItem appears on the primary toolbar surface or secondary.

ViewState

Deprecated. Do not use.

WebNavigationEvent

Contains values that indicate why a navigation event was raised.

WebNavigationResult

Enumerates values that indicate the outcome of a web navigation.

Delegates

BindableProperty.BindingPropertyChangedDelegate

Delegate for BindableProperty.PropertyChanged.

BindableProperty.BindingPropertyChangedDelegate<TPropertyType>

Strongly-typed delegate for BindableProperty.PropertyChanged.

BindableProperty.BindingPropertyChangingDelegate

Delegate for BindableProperty.PropertyChanging.

BindableProperty.BindingPropertyChangingDelegate<TPropertyType>

Strongly-typed delegate for BindableProperty.PropertyChanging.

BindableProperty.CoerceValueDelegate

Delegate for BindableProperty.CoerceValue.

BindableProperty.CoerceValueDelegate<TPropertyType>

Strongly-typed delegate for BindableProperty.CoerceValue.

BindableProperty.CreateDefaultValueDelegate

Strongly typed delegate for BindableProperty.DefaultValueCreator.

BindableProperty.CreateDefaultValueDelegate<TDeclarer,TPropertyType>

Delegate for BindableProperty.DefaultValueCreator.

BindableProperty.ValidateValueDelegate

Delegate for BindableProperty.ValidateValue.

BindableProperty.ValidateValueDelegate<TPropertyType>

Strongly-typed delegate for BindableProperty.ValidateValue.

CollectionSynchronizationCallback

Delegate for callback in Xamarin.Forms.BindingBase.EnableCollectionSynchronization.

PropertyChangingEventHandler

Delegate for the PropertyChanging event.

Remarks

Xamarin.Forms is a cross-platform, natively-backed UI toolkit abstraction that allows developers to create user interfaces that can be shared across Android, iOS, and Windows Phone. Because the user interfaces use the native controls of the target platforms, they have the appearance and, importantly, the responsiveness of natively built apps.

Xamarin.Forms Solution Architecture

Cross-Platform Project

The user-experience of a Xamarin.Forms application is usually defined in a cross-platform shared project (either a Portable Class Library or a Shared Project) and combined with platform-specific projects that, at the least, initialize the native platform rendering (note the call to Forms.Init() in the platform code samples below) and, more generally, extend the user-experience and user-interface in platform-specific manners (for instance, by accessing platform-specific sensors or capabilities).

For example, the developer can create a cross-platform Xamarin.Forms Label and display it with the following code in the shared project:


public class App : Xamarin.Forms.Application
{
    public App ()
    {
        MainPage = new ContentPage
        {
            Content = new Label
                {
                    Text = "Welcome to Xamarin Forms!",
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                },
        };
    }
}
          

This code results in a centered label on the target platforms:

While more complicated layouts with more useful user interfaces are more typical, this example is useful for clearly illustrating the shared and platform-specific code that Xamarin.Forms uses to create and display the code on the target platforms. The code in the following discussion is created by Visual Studio in the target platform projects when the developer creates a new Xamarin.Forms project. In each case, a platform-specific Forms.Init() method is called to intitialize forms before any other method that depends on Xamarin.Forms is called.

iOS Platform Code

On the iOS platform, Visual Studio registers a Xamarin.Forms.Platform.iOS.FormsApplicationDelegate as the entry point of the application, and immediately makes a call to Xamarin.Forms.Forms.Init.


[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        global::Xamarin.Forms.Forms.Init();
        LoadApplication(new App());

        return base.FinishedLaunching(app, options);
    }
}
          

Android Platform Code

The entry point on Android is a Xamarin.Forms.Platform.Android.FormsAppCompatActivity, and its OnCreate method must configure the tab bar and toolbars and call its base method before calling Forms.Init.


            [Activity(Label = "HelloXamarinFormsWorld.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
            public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
            {
                protected override void OnCreate(Bundle bundle)
                {
                    TabLayoutResource = Resource.Layout.Tabbar;
                    ToolbarResource = Resource.Layout.Toolbar;

                    base.OnCreate(bundle);

                    global::Xamarin.Forms.Forms.Init(this, bundle);

                    LoadApplication(new App());
                }

                protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
                {
                    base.OnActivityResult(requestCode, resultCode, data);
                }
            }
          

UWP Code

The entry point for a Xamarin.Forms app on UWP is just the constructor for a Windows.UI.Xaml.Application in App.xaml.cs in the UWP platform project. However, the application lifecycle on UWP is such that the call to Forms.Init must take place inside the OnLaunched method, and is guarded against being run more than once. The necessary code is beyond the scope of this documentation, but the curious developer is encouraged to create a test Xamarin.Forms solution and study the code in the App.xaml.cs file for more details

Elements in Xamarin.Forms

Important types in the Xamarin.Forms namespace include Page, View, and Layout. Pages typically correspond with controller objects (Activities in the Android world, UIViewControllers in the iOS world), Views with controls or widgets, and Layouts arrange Views on other Views. These types are all derived from Element.

Model-View-ViewModel and Xamarin.Forms

Application developers use the Model-View-ViewModel (MVVM) pattern to create Xamarin.Forms apps that cleanly separate the concerns of data presentation and user interface from the concerns of data storage and manipulation. The Xamarin.Forms framework enables this by providing, among a few other related types, the BindableObject and BindableProperty classes. Objects that inherit from BindableObject can be bound to members of type BindableProperty on other objects.

A BindableObject maintains dictionary of BindableProperty names and an association with their corresponding binding contexts--simply the object on which the BindableProperty is defined and that the application developer has assigned to the Xamarin.Forms.BindingObject.BindingContext property--through a Binding. See BindableObject for more information.