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:
- 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:
- 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:
Shows the use of ResourceDictionary with markup extensions.
- 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:
No significant new classes shown besides ResourceDictionary which markup extensions then use.
Program ResourceTrees
Pages 214-215.
Concepts:
Shows how ResourceDictionary elements can be nested inside objects throughout the tree like.
- Similar to CSS inner or local keys override outer keys. This should be intuitive for everyone!
Classes:
No significant new classes shown:
- markup extensions.
Program DynamicVsStatic
Page 202.
Concepts:
Shows the markup extension DynamicResource
- So cool you can use this similar to binding since changes to one reference will update all other references.
Classes:
DynamicResource - markup extension
Program CustomExtensionDemo
Page 225.
Concepts:
- Shows how to create and use a Custom markup extension
- The example creates a multi-parameter markup extension to instantiate a color object from HSLA spec.
Classes:
HslColorExtension : IMarkupExtension