IVisualTreeService::CreateInstance method (xamlom.h)

Creates an instance of any XAML runtime, enum, or primitive type.

Syntax

HRESULT CreateInstance(
  [in]          BSTR           typeName,
  [in]          BSTR           value,
  [out, retval] InstanceHandle *pInstanceHandle
);

Parameters

[in] typeName

The type name. (Should be from PropertyChainValue.Type.)

[in] value

The value to set on a primitive or enum type. null if creating a XAML runtime type.

[out, retval] pInstanceHandle

An instance handle to newly created instance.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

For primitives and enums, value should be set to desired value. For XAML runtime types, value should be null.

Requirements

Requirement Value
Minimum supported client Windows 10 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header xamlom.h

See also

IVisualTreeService