Styling Xamarin.Forms Apps using XAML Styles

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 setting 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 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.

Style Classes

Xamarin.Forms style classes enable multiple styles to be applied to a control, without resorting to style inheritance.