Bagikan melalui


IXamlDirect.InsertIntoCollectionAt(Object, UInt32, Object) Metode

Definisi

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

Dokumentasi ini berlaku untuk WinUI 2 untuk UWP (untuk WinUI di SDK Aplikasi Windows, lihat namespace SDK Aplikasi Windows).

public:
 void InsertIntoCollectionAt(Platform::Object ^ xamlDirectObject, unsigned int index, Platform::Object ^ value);
void InsertIntoCollectionAt(IInspectable const& xamlDirectObject, uint32_t const& index, IInspectable const& value);
public void InsertIntoCollectionAt(object xamlDirectObject, uint index, object value);
Public Sub InsertIntoCollectionAt (xamlDirectObject As Object, index As UInteger, value As Object)

Parameter

xamlDirectObject
Object

Platform::Object

IInspectable

Mengacu pada koleksi IXamlDirect tertentu.

index
UInt32

unsigned int

uint32_t

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

value
Object

Platform::Object

IInspectable

Mengacu pada nilai IXamlDirect untuk ditambahkan ke koleksi.

Contoh

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

XamlDirect xd = XamlDirect.GetDefault();

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

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

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

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

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

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

Berlaku untuk

Lihat juga