Read the previous parts of the series here,
- Quick Start Tutorial: Creating Universal Apps Via Xamarin - Part One
- Quick Start Tutorial: Creating Universal Apps Via Xamarin - Part Two
- Quick Start Tutorial: Creating Universal Apps via Xamarin: Label and Button - Part Three
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: Device class - Part Four
- Quick Start Tutorial: Creating Universal Apps via Xamarin: Device Class (cont.) - Part Five
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: Entry Control - Part Six
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: StackLayout and Layout Options - Part Seven
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: DisplayAlert and DisplayActionSheet - Part Eight
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: Date Picker, Time Picker and Activity Indicator - Part Nine
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: XAML And Resource Dictionary - Part Ten
Style
In the resource dictionary, we can assign one property into one key; style is one key with a one-or-more properties relationship.
Style is a collection of the property values assigned to one or more elements and it must be declared into the ResourceDictionary tag. Style collection defines setter property, and setter contains the property and value.
Type of styles,
- Explicit style
- Implicit style
Explicit style
Explicit style is declared as the Key and Target type relationship.
Syntax of style
<Style x: Key="KeyName" TargetType="Control Type">
<Setter Property="PropertyName" Value="PropertyValue"/>
</Style>
Example
- <Stylex:Key="StyleLabel"TargetType="Label">
- <SetterProperty="FontSize"Value="34"/>
- <SetterProperty="TextColor"Value="Red"/>
- </Style>
Assign the style into the controls and use Style Property.
- <LabelText="Hey Style"Style="{StaticResource StyleLabel}"/>

Implicit style
Implicit style is declared as only the target type (key is not required), default is applicable to all the target types.
Syntax of style
<Style TargetType="Control Type">
<Setter Property="PropertyName" Value="PropertyValue"/>
</Style>
Example
- <Style TargetType="Label">
- <SetterProperty="FontSize" Value="34" />
- <SetterProperty="TextColor" Value="Green" />
- </Style>




Santhakumar MunuswamyPosted Jun 25, 2016, 12:22 AM
Nice share
Bhuvanesh MohankumarPosted Jun 24, 2016, 12:54 PM
Good one
Debasis SahaPosted Jun 24, 2016, 9:03 AM
Good One..
kalu singh raoPosted Jun 24, 2016, 1:34 AM
Nice...
RajaPosted Jun 24, 2016, 12:12 AM
Nice Share...
Kuppurasu NagarajPosted Jun 23, 2016, 1:21 PM
Nice Sharing..
Prasanna MuraliPosted Jun 23, 2016, 12:03 PM
nice one