Chapter 10 Notes

Title: XAML Markup Extensions

Summary

<All about="{x:Static Markup.Extensions}" />

Programming Concepts Summary

In general a markup extension is a class that can produce a value that can be directly assigned to a attribute/property of an element/object. It is represented in XAML and parsed appropriately as a Markup Extension. Although you can write your own, you shouldn't need to right now.

See Page 199 for a list of included markup extensions.

Programs

Program SharedStatics

Page 202.

Concepts:

  1. Shows the use of user defined static variables in markup extensions.

Classes:

No significant new classes shown - but markup extensions are used.

Program SystemStatics

Page 202.

Concepts:

  1. Shows the use of externally defined static variables in markup extensions.

Classes:

No significant new classes shown - but markup extensions are used.

Program ResourceSharing

Page 211.

Concepts:

  1. Shows the use of ResourceDictionary with markup extensions.

  2. page 213 shows the simplified markup usage and when to use x:key (when you are defining it) and when not to use the x: (as in when you are in the actually markup extension curly brackets).

Classes:

  1. No significant new classes shown besides ResourceDictionary which markup extensions then use.

Program ResourceTrees

Pages 214-215.

Concepts:

  1. Shows how ResourceDictionary elements can be nested inside objects throughout the tree like.

  2. Similar to CSS inner or local keys override outer keys. This should be intuitive for everyone!

Classes:

No significant new classes shown:

  1. ResourceDictionary

  2. markup extensions.

Program DynamicVsStatic

Page 202.

Concepts:

  1. Shows the markup extension DynamicResource

  2. So cool you can use this similar to binding since changes to one reference will update all other references.

Classes:

  1. DynamicResource - markup extension

Program CustomExtensionDemo

Page 225.

Concepts:

  1. Shows how to create and use a Custom markup extension
  2. The example creates a multi-parameter markup extension to instantiate a color object from HSLA spec.

Classes:

  1. HslColorExtension : IMarkupExtension

ManagingAndProgrammingMobileApplications/Xamarin/Chapter 10 (last edited 2016-09-21 22:08:15 by scot)