IXamlDirect.CreateInstance(XamlTypeIndex) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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);