About XAML
XAML is an XML document. XAML is used to describe the components or elements of a user interface. The following example describes a 350
-by-350
-pixel Window
containing a Label
:
<?xml version="1.0" encoding="utf-8"?>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="350" Height="350">
<Label Content="Hello world" />
</Window>
The two namespace declarations in the xmlns
and xmlns:x
attributes are mandatory and cannot be omitted.
The document must first be read into an XmlDocument
; the Xml
type accelerator can be used for this. Then an XmlNodeReader
is created by casting from an XmlDocument
. Finally, the document is parsed using the XamlReader
to create the user interface controls from the document:
$xaml = [xml]'<?xml version="1.0" encoding="utf-8"...