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
- Quick Start Tutorial: Creating Universal Apps via Xamarin: Style in XAML - Part Eleven
Style in Inheritance
Style can be derived from another style; BasedOn and BaseResoruceKey can be used to implement the inheritance concept.
BasedOn
BasedOn style supports the StaticResource (value can’t be changed at runtime) and the inheritance of both types are Base Style and Derive type, and should be of the same target type.
Syntax of Inheritance Style
- <Style x: Key="KeyName" TargetType="Control Type" BasedOn="{StaticResource StyleName}”>
- <Setter Property="PropertyName" Value="PropertyValue"/>
- < /Style>
Example
- <ContentPage.Resources>
- <ResourceDictionary>
- <Style x:Key="BaseLabelStyle" TargetType="Label">
- <Setter Property="FontSize" Value="20" />
- </Style>
- <Style x:Key="LabelStyle" TargetType="Label" BasedOn="{StaticResource BaseLabelStyle}">
- <Setter Property="TextColor" Value="Red" />
- </Style>
- </ResourceDictionary>
- </ContentPage.Resources>
- <StackLayout>
- <Label Text="BasedOn Style" Style="{StaticResource LabelStyle}"/>
- </StackLayout>





Davronbek UmirovPosted Jun 28, 2016, 3:54 AM
Nice..
Debasis SahaPosted Jun 27, 2016, 2:53 AM
Nice one..
kalu singh raoPosted Jun 27, 2016, 1:44 AM
Nice...
Thiruppathi RPosted Jun 27, 2016, 1:04 AM
Nice
Anu VPosted Jun 27, 2016, 12:29 AM
Nice
RajaPosted Jun 27, 2016, 12:26 AM
Good One...
Vignesh ManiPosted Jun 26, 2016, 4:41 PM
Ncie
Debasis SahaPosted Jun 25, 2016, 2:53 AM
Nice one..
Santhakumar MunuswamyPosted Jun 25, 2016, 12:20 AM
Nice share
Prasanna MuraliPosted Jun 24, 2016, 9:41 PM
Nice one..
Bhuvanesh MohankumarPosted Jun 24, 2016, 12:38 PM
Good one