[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Parses a well-formed XAML fragment and creates a corresponding Windows Phone object tree, and returns the root of the object tree.
Assembly: System.Windows (in System.Windows.dll)
Public Shared Function Load ( _ xaml As String _ ) As Object
public static Object Load( string xaml )
A string that contains a valid XAML fragment.
The root object of the Windows Phone object tree.
A "well-formed XAML fragment" must meet the following requirements:
The XAML content string must define a single root element.
The content string XAML must be well formed XML, as well as being parseable XAML.
The required root element must also specify a default XML namespace value. This is typically the Windows Phone namespace, xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation". This XML namespace is required explicitly in Windows Phone .
Note that these conditions report parsing exceptions but the message in the exception will specifically note the cause indicating a general format failure rather than a specific parsing failure against the vocabulary identified by the XML namespace.
Beyond being "well-formed", Load will also report failures that occur when the XAML is submitted to the parser.
Any objects with a Name or x:Name value in the input XAML will be considered to be within a discrete XAML namescope, once the returned object tree is added to the main object tree. This can influence your ability to find the object in scope with FindName.
Windows Phone OS
Supported in: 8.1, 8.0, 7.1, 7.0