Share via


xml:space Handling in XAML

The xml:space attribute is an XML-defined attribute that declares the significant whitespace processing behavior within an object element. This behavior is relevant for all content (inner text) contained within the element where xml:space is declared, and also scopes to child elements.

XAML Attribute Usage

<object xml:space="preserve" />

- or -

<object xml:space="default" />

Remarks

The definition for the xml:space attribute in XAML including its two possible values is derived from xml:space as defined as a "special attribute" by W3C specifications for XML.

The default value of the xml:space attribute is the literal value "default". For the value "default", or if xml:space is not indicated at all, the behavior of significant whitespace parsing is the default handling, as defined in the topic Whitespace Processing in XAML.

To preserve whitespace within object element content, specify xml:space="preserve" on that object element.

Under most interpretations, the xml:space attribute effects and the value of the attribute are scoped to child elements.

For a complete discussion of whitespace processing in XAML, see Whitespace Processing in XAML.

See Also

Concepts

Whitespace Processing in XAML

XAML Overview (WPF)