Share via


IXRApplication::ParseXaml (Compact 2013)

3/28/2014

This method parses the specified source XAML into a XAML for Windows Embedded object. This XAML for Windows Embedded object can be inserted into an existing element tree, or it can become the root of a new element tree hosted by a visual host.

Syntax

virtual HRESULT STDMETHODCALLTYPE ParseXaml(
    XRXamlSource* pSource,
    IXRDependencyObject**   ppDependencyObject
) = 0;

Parameters

  • pSource
    [in] Pointer to an XRXamlSource structure that contains information that represents the source of the XAML markup.
  • ppDependencyObject
    [out] Address of a pointer to an IXRDependencyObject object that is created by parsing the source XAML markup.

Return Value

Returns an HRESULT that indicates success or failure.

When a XAML parser error occurs, this method can also return one of the following error messages:

Error message

Description

XR_E_PARSER_MISSING_DEFAULT_NAMESPACE

The root element of the source XAML is missing the default namespace declaration.

XR_E_PARSER_UNKNOWN_ELEMENT

The element that is being parsed is unknown to XAML for Windows Embedded.

XR_E_PARSER_UNKNOWN_ATTRIBUTE

The attribute that is being parsed is unknown to XAML for Windows Embedded.

XR_E_PARSER_UNKNOWN_NAMESPACE

The element or attribute that is being parsed belongs to an unknown namespace.

XR_E_PARSER_INVALID_PROPERTY

The property that is being parsed is invalid in this context.

XR_E_PARSER_MULTIPLE_PROPERTY_ELEMENT_VALUES

There are multiple property element values for the given element; for example:

<a><a.b>text1</a.b><a.b>text2</a.b></a>

XR_E_PARSER_INVALID_ATTRIBUTE

Both x:Name and Name cannot be specified on an element.

XR_E_PARSER_INVALID_ATTRIBUTE_VALUE

The value for this attribute is invalid.

XR_E_PARSER_ATTRIBUTE_OUT_OF_RANGE

The value for this attribute is out of acceptable range.

XR_E_PARSER_ATTRIBUTE_READONLY

This attribute is read-only and cannot be set in XAML.

XR_E_PARSER_FAILED_RESOURCE_FIND

The static resource could not be resolved.

XR_E_PARSER_RESOURCE_KEY_AND_NAME_SET

Both x:Key and x:Name attributes cannot be set in this element inside a resource dictionary.

XR_E_PARSER_TEXT_CONTENT_UNSUPPORTED

This element does not support text as its content.

XR_E_PARSER_INVALID_CONTENT

The content for this element is invalid.

Remarks

On return, ppDependencyObject contains an IXRDependencyObject object. IXRDependencyObject is the base class for all objects in XAML for Windows Embedded that represent UI elements, controls, collections, or appearance and behavior resources.

To use a specific interface pointer type, you can use the helper template version of this method that XAML for Windows Embedded provides. When you supply a derived type, this version automatically supplies a type-safe method that implicitly converts the returned type from a generic interface so you do not have to explicitly call IUnknown::QueryInterface to convert the generic interface into the required object type.

This method assists in integrating a XAML for Windows Embedded application together with the UI controls and UI resources defined in XAML.

If you want to create a visual host and also generate an element tree by parsing the XAML, call IXRApplication::CreateHostFromXaml instead of this method.

If you want to create a visual host and already have an element tree, call IXRApplication::CreateHostFromElementTree instead of this method.

Note

Boolean data types defined in the source XAML file being parsed are case-sensitive and must be in the correct case. For example, "True" and "False."

.NET Framework Equivalent

None.

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRApplication