Styles

Using styles to customize appearance

PDF for offline use:

Let us know how you feel about this.


0/250
Thanks for the feedback!

last updated: 2016-02

Introduction

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.

Explicit Styles

An explicit style is one that is selectively applied to controls by setting their Style properties.

Implicit Styles

An implicit style is one that's used by all controls of the same TargetType, without requiring each control to reference the style.

Global Styles

Styles can be made available globally by adding them to the application's ResourceDictionary. This helps to avoid duplication of styles across pages or controls.

Style Inheritance

Styles can inherit from other styles in order to reduce duplication and enable reuse.

Dynamic Styles

Styles do not respond to property changes, and remain unchanged for the duration of an application. However, applications can respond to style changes dynamically at runtime by using dynamic resources.

Device Styles

Xamarin.Forms includes six dynamic styles, known as device styles, in the Devices.Styles class. All six styles can be applied to Label instances only.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.