Chapter 12 Notes
Title: Styles
Summary
Setting styles on your Views.
Programming Concepts Summary
Concept |
Page |
Style defined in a resource dictionary an element like ContentPage |
254 |
Style inheritance |
261 |
Programs
Program BasicStyle
Page 255.
Concepts:
Shows how to setup a style and used it with a Button
Classes:
No new classes.
Program BasicStyleCode
Page 259.
Concepts:
Shows how to setup a style in a ResourceDictionary and used it with a Button in code.
Classes:
No new classes.
Program Modified BasicStyle
Page 259.
Concepts:
Shows how to setup a style in a ResourceDictionary and used it with multiple view types by setting its TargetType = "View".
Classes:
No new classes.
Program StyleInheritance
Page 263.
Concepts:
Shows how inheritance works with nested containers like StackLayout.
Shows how to inheritance within a group by using the basedon attribute to inherit from another style.
Classes:
No new classes.
Program ImplicitStyle
Page 265.
Concepts:
Shows implicit styles - that is styles that are applied to an object even when it doesn't specify a style. How, a TargetType without a x:Key.
Classes:
No new classes.
Program StyleHierarchy
Page 268.
Concepts:
- Shows hierarchical styles from the app.xaml file.
Classes:
No new classes.
Program DynamicStyles
Page 271.
Concepts:
Shows Dynamic vs. the StaticResource styles we have used so far
- Shows buttons that can be dynamically change their styles - cool demo.
Classes:
No new classes.
Program DynamicStylesInheritance
Page 275.
Concepts:
similar to the previous program this one adds BaseResourceKey to reference the buttonStyle entry and add a couple of properties including OnPlatform.
Classes:
No new classes.
Program DeviceSytlesList
Page 278.
Concepts:
Xamarin.Forms includes six built-in styles known as device styles that are members of a nested class of Device} named Styles. This Style class defines 12 static readonly fields that help reference these six styles in code.
BodyStyle of type Style.
BodyStyleKey of type string and equal to BodyStyle.”
TitleStyle of type Style.
TitleStyleKey of type string and equal to TitleStyle.”
SubtitleStyle of type Style.
SubtitleStyleKey of type string and equal to {{{SubtitleStyle.”
CaptionStyle of type Style.
CaptionStyleKey of type string and equal to CaptionStyle.”
ListItemTextStyle of type Style.
ListItemTextStyleKey of type string and equal to ListItemTextStyle.”
ListItemDetailTextStyle of type Style.
ListItemDetailTextStyleKey of type string and equal to ListItemDetailTextStyle.
Classes:
- Device.Styles is a list of the above styles that are unique to the device.