* Add overview article for new WPF (#178) * Remove previous WPF .NET 5 content * Overview article * New article: Create new WPF project (#183) * Basic index file * Finish article for new project. * acro * markdown fix * Fix build errors * fix code lang * fix code lang * Add differences article for WPF (#186) * Fix VS version for create app * Add differences article * Minor * fix overview styles code * Add code langs for overview * Port Window Overview WPF article (#1011) * Add Window overview article * Add TOC * Remove temp code * Fix headers * Port final Windows related articles (#1015) * Initial test commit * Add system dialogs * 75% complete * Add images * Fix linter * Add to toc * Add more howto * Fix code * Add get/set main window * Add missing code * Add to toc * Fix warnings * Fix warnings * missing code * Update see also * fix xref * Migrate wpf net core controls-styles articles (#1023) * Migrate control-styles * Fix links * Fix links * Port databinding article. (#1022) * Migrated databinding overview * update toc * Fix links/snippets * fix links * Move to correct folder * Port initial resources docs (#1026) * initial resources docs * Build errors * Update dotnet-desktop-guide/net/wpf/systems/xaml-resources-overview.md Co-authored-by: Genevieve Warren <[email protected]> * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> * Feedback * Add app article * Add system article * Minor * meta * fix toc * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> Co-authored-by: Genevieve Warren <[email protected]> * Add xaml article * reformat redirect * Redirects * WPF update XAML article (#1031) * convert snippets * minor edits * minor * Fix warnings * Fixes #1028 * Fixes #1028 * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> * update redirects Co-authored-by: Genevieve Warren <[email protected]> * minor updates to link * Readd migration article * Warning fixes * Fix lint * Minor updates * Fix warnings for TOC/YML * last warnings Co-authored-by: Genevieve Warren <[email protected]>
4.8 KiB
title, description, ms.date, f1_keywords, helpviewer_keywords, ms.assetid
| title | description | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| XML Character Entities and XAML | Describes how special characters are handled in XAML and general considerations for other XML concepts in XAML. | 03/30/2017 |
|
|
6896d0ce-74f7-420a-9ab4-de9bbf390e8d |
XML Character Entities and XAML
XAML uses character entities defined in XML for special characters. This topic describes some specific character entities and general considerations for other XML concepts in XAML.
Character Entities and Escaping Issues That Are Unique to XAML
XAML markup typically uses the same character entities and escape sequences that are defined in XML.
The main exception is that braces ({ and }) have significance in XAML because these characters inform a XAML processor that a character sequence enclosed by braces must be interpreted as a markup extension. For more information about markup extensions, see Markup Extensions for XAML Overview.
However, you can still display the braces as literal characters by using an escape sequence that is particular to XAML instead of XML. For more information, see {} Escape Sequence - Markup Extension.
Note that a backslash (\) does not require an escape sequence when it is handled as a string.
XML Character Entities
As mentioned previously, most character entities and escape sequences that are typically used to write XAML markup are defined by XML. This topic does not provide the complete list of these entities; a detailed reference for the entities can be found in external documentation, such as in XML specifications. However, for convenience, this topic lists some of the specific XML character entities that are typically used in XAML markup.
| Character | Entity | Notes |
|---|---|---|
| & (ampersand) | & | Must be used both for attribute values and for content of an element. |
| > (greater-than character) | > | Must be used for an attribute value, but > is acceptable as the content of an element as long as < does not precede it. |
| < (less-than character) | < | Must be used for an attribute value, but < is acceptable as the content of an element as long as > does not follow it. |
| " (straight quotation mark) | " | Must be used for an attribute value, but a straight quotation mark (") is acceptable as the content of an element. Note that attribute values may be enclosed either by a single straight quotation mark (') or by a straight quotation mark ("); whichever character appears first defines the attribute value enclosure, and the alternative quote can then be used as a literal within the value. |
| ' (single straight quotation mark) | ' | Must be used for an attribute value, but a single straight quotation mark (') is acceptable as the content of an element. Note that attribute values may be enclosed either by a single straight quotation mark (') or by a straight quotation mark ("); whichever character appears first defines the attribute value enclosure, and the alternative quote can then be used as a literal within the value. |
| (numeric character mappings) | &#[integer]; or &#x*[hex]*; | XAML supports numeric character mappings into the encoding that is active. |
| (nonbreaking space) |   (assuming UTF-8 encoding) | For flow document elements, or elements that take text such as the WPF xref:System.Windows.Controls.TextBox, nonbreaking spaces are not normalized out of the markup, even for xml:space="default". (For more information, see White-space processing in XAML.) |
XML Comment Format
XAML uses the XML comment format: the start of the comment is <!--, the end of comment is -->, and the sequence -- must not occur within the comment.
XML Processing Instructions
XAML handles XML processing instructions according to XML specifications, which state that the instructions must be passed through. XAML processing in .NET XAML Services does not use any processing instructions. Other existing frameworks that use XAML also do not use processing instructions from XAML.