Bagikan melalui


XamlDirect.InsertIntoCollectionAt Metode

Definisi

Menyisipkan nilai ke dalam koleksi IXamlDirectObject yang ditentukan pada indeks yang ditentukan.

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)

Parameter

xamlDirectObject
IXamlDirectObject

Mengacu pada koleksi IXamlDirectObject tertentu.

index
UInt32

unsigned int

uint32_t

Mengacu pada indeks dalam koleksi tempat nilai yang ditentukan harus disisipkan.

value
IXamlDirectObject

Mengacu pada nilai IXamlDirectObject untuk ditambahkan ke koleksi.

Contoh

Contoh berikut menunjukkan cara menyisipkan nilai ke dalam koleksi pada indeks tertentu menggunakan API XamlDirect .

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);

Berlaku untuk

Lihat juga