IXamlDirect.CreateInstance(XamlTypeIndex) Method

Definition

Creates an IXamlDirect instance of the type specified by the XamlTypeIndex parameter.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

public:
 Platform::Object ^ CreateInstance(XamlTypeIndex typeIndex);
IInspectable CreateInstance(XamlTypeIndex const& typeIndex);
public object CreateInstance(XamlTypeIndex typeIndex);
Public Function CreateInstance (typeIndex As XamlTypeIndex) As Object

Parameters

typeIndex
XamlTypeIndex

Refers to the specific XAML type from the set of supported types listed in the XamlTypeIndex enum.

Returns

Object

Platform::Object

IInspectable

Returns the IXamlDirect instance.

Examples

The following example shows how to create an IXamlDirect instance for a Border element.

XamlDirect xd = XamlDirect.GetDefault();
IXamlDirect border = xd.CreateInstance(XamlTypeIndex.Border);
XamlDirect^ xd = XamlDirect::GetDefault();
IXamlDirect^ border = xd->CreateInstance(XamlTypeIndex::Border);

Applies to

See also