XamlDirect.CreateInstance(XamlTypeIndex) 方法

定義

建立XamlTypeIndex參數所指定類型的IXamlDirectObject實例。

public:
 virtual IXamlDirectObject ^ CreateInstance(XamlTypeIndex typeIndex) = CreateInstance;
IXamlDirectObject CreateInstance(XamlTypeIndex const& typeIndex);
public IXamlDirectObject CreateInstance(XamlTypeIndex typeIndex);
function createInstance(typeIndex)
Public Function CreateInstance (typeIndex As XamlTypeIndex) As IXamlDirectObject

參數

typeIndex
XamlTypeIndex

XamlTypeIndex 列舉中列出的一組支援型別參考特定的 XAML 類型。

傳回

傳回 IXamlDirectObject 實例。

範例

下列範例示範如何建立Border元素的IXamlDirectObject實例。

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

適用於

另請參閱