IXamlDirect.CreateInstance(XamlTypeIndex) メソッド

定義

XamlTypeIndex パラメーターで指定された型の IXamlDirect インスタンスを作成します。

このドキュメントは、UWP 用 WinUI 2 に適用されます (Windows アプリ SDKWinUI については、Windows アプリ SDK名前空間を参照してください)。

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

パラメーター

typeIndex
XamlTypeIndex

XamlTypeIndex 列挙型に記載されているサポートされている型のセットから、特定の XAML 型を参照します。

戻り値

Object

Platform::Object

IInspectable

IXamlDirect インスタンスを返します。

次の例は、Border 要素の IXamlDirect インスタンスを作成する方法を示しています。

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

適用対象

こちらもご覧ください