Controls with Xamarin.Forms

Xamarin.Forms uses the native controls of each target platform. This means applications can use Portable Class Libraries or Shared Projects to house this shared code, and then make platform specific applications that will consume the shared code.

There are four main control groups used to create the user interface of a Xamarin.Forms application:

  • Pages
  • Layouts
  • Views
  • Cells

At runtime each control will be mapped to its native equivalent, which is what will be rendered.

Pages

The Page class is a visual element that occupies most or all of the screen and contains a single child. A Xamarin.Forms.Page represents a View Controller in iOS or a Page in Windows Phone. On Android each page takes up the screen like an Activity, but Xamarin.Forms Pages are not Activities.

Layouts

The Layout class in Xamarin.Forms is a specialized subtype of View, which acts as a container for other Layouts or Views. It typically contains logic to set the position and size of child elements in Xamarin.Forms applications.

Views

Xamarin.Forms uses the word View to refer to visual objects such as buttons, labels or text entry boxes - which may be more commonly known as controls of widgets.

Cells

A Cell is a specialized element used for items in a table and describes how each item in a list should be drawn. Cell derives from Element, from which VisualElement also derives. However Cell is not a visual element, it just describes a template for creating a visual element. Xamarin.Forms.Cell provides base class and capabilities for all Xamarin.Forms cells. Cells are elements designed to be added to ListView or TableView controls.

No Comments

Add a Comment

As it will appear on the website

Not displayed

Your website