XamlDirect.InsertIntoCollectionAt 方法

定义

将值插入到指定索引处的指定 IXamlDirectObject 集合中。

public:
 virtual void InsertIntoCollectionAt(IXamlDirectObject ^ xamlDirectObject, unsigned int index, IXamlDirectObject ^ value) = InsertIntoCollectionAt;
void InsertIntoCollectionAt(IXamlDirectObject const& xamlDirectObject, uint32_t const& index, IXamlDirectObject const& value);
public void InsertIntoCollectionAt(IXamlDirectObject xamlDirectObject, uint index, IXamlDirectObject value);
function insertIntoCollectionAt(xamlDirectObject, index, value)
Public Sub InsertIntoCollectionAt (xamlDirectObject As IXamlDirectObject, index As UInteger, value As IXamlDirectObject)

参数

xamlDirectObject
IXamlDirectObject

引用特定的 IXamlDirectObject 集合。

index
UInt32

unsigned int

uint32_t

引用集合中必须插入指定值的索引。

value
IXamlDirectObject

引用要添加到集合中的 IXamlDirectObject 值。

示例

以下示例演示如何使用 XamlDirect API 将值插入集合中的特定索引处。

XamlDirect xd = XamlDirect.GetDefault();

IXamlDirectObject relativePanel = xd.CreateInstance(XamlTypeIndex.RelativePanel);

IXamlDirectObject childrenCollection = xd.GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex.Panel_Children);

IXamlDirectObject button = xd.CreateInstance(XamlTypeIndex.Button);
xd.InsertIntoCollectionAt(childrenCollection, 0, button);
XamlDirect^ xd = XamlDirect::GetDefault();

IXamlDirectObject^ relativePanel = xd->CreateInstance(XamlTypeIndex::RelativePanel);

IXamlDirectObject^ childrenCollection = xd->GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex::Panel_Children);

IXamlDirectObject^ button = xd->CreateInstance(XamlTypeIndex::Button);
xd->InsertIntoCollectionAt(childrenCollection, 0, button);

适用于

另请参阅