Type Conversion of an Element’s Contents

Chapter 2, “Child Elements and Keywords,” listed three types of children for an object element: a value for a content property, collection items, and a value that can be type-converted to the object element. It’s now time to look at the third type of child.

Plain text can often be used as the child of an object element, as in the following XAML declaration of SolidColorBrush:

<SolidColorBrush>White</SolidColorBrush>

This is equivalent to the following:

<SolidColorBrush Color="White"/>

This seems normal, until you realize that Color has not been designated as SolidColorBrush’s content property. It has no content property. In this case, the first ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.