Compartilhar via


IXRApplication::CreateHostFromXaml (Compact 2013)

3/28/2014

This method parses the source XAML, generates an element tree, and instantiates a visual host that hosts the element tree so that an application can access or modify the elements in that tree.

Syntax

virtual HRESULT STDMETHODCALLTYPE  CreateHostFromXaml(
    XRXamlSource*         pSource,
    XRWindowCreateParams* pCreateParams,
    IXRVisualHost**       ppHost
) = 0;

Parameters

  • pSource
    [in] Pointer to an XRXamlSource structure that contains information that represents the source of the XAML markup.
  • pCreateParams
    [in] Pointer to an XRWindowCreateParams structure that includes parameters that are used to create the host window. This parameter is optional.
  • ppHost
    [out] Pointer to the newly created IXRVisualHost host object that hosts the generated element tree in a window.

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 content for this element cannot be text.

XR_E_PARSER_INVALID_CONTENT

The content for this element is invalid.

Remarks

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 already have an element tree, call IXRApplication::CreateHostFromElementTree instead of this method.

If you want to create an element tree only, call IXRApplication::ParseXaml 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