IXRApplication::CreateControlByName (Compact 2013)

3/28/2014

This method uses the factory that you registered to create an instance of a custom user control by using the provided control name.

Syntax

virtual HRESULT STDMETHODCALLTYPE CreateControlByName(
    const WCHAR* pNamespace,
    const WCHAR* pName,
    IXRDependencyObject**  ppObject
) = 0;

Parameters

  • pNamespace
    [in] Pointer to a string that contains the XML namespace of the custom user control. For example, clr-namespace:custom_controls.
  • pName
    [in] Pointer to a string that contains the name of the custom user control.

Return Value

An HRESULT returns S_OK if successful; otherwise, returns a non-zero error code.

Remarks

Call IXRApplication::RegisterControlFactory to register a control factory before you call this method.

After this method returns, the object that ppObject points to is not automatically added to the visual tree. All visual elements, including those parsed from XAML, are stored in a visual tree. To add the new object to the visual tree, set it as the property of an object in the tree or add it to a collection in the tree, such as IXRUIElementCollection.

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.

.NET Framework Equivalent

None.

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRApplication