Styles
In our custom cell we have three labels without any styling or font assignation. We are going to spice up the look of each cell using Style
. A Style
groups a collection of property values into one object that can be applied to multiple visual element instances. The idea of this is to reduce repetitive markup so we can reuse similar styles across similar controls in our XAML. There are multiple ways to apply styling to a control in Xamarin.Forms
. In this example, we will show you how to create a global style in the App.xaml
file, and apply it to different controls in our application.
Our first global style will be for the title label in our custom cell. Let's open up the App.xaml
file and insert the following into our resource dictionary:
<Style x:Key="TitleStyle" TargetType="Label"> <Setter Property="TextColor" Value="Black" /> <Setter Property="FontAttributes" Value="Bold" /> <Setter Property="FontFamily...