IXamlDirect.InsertIntoCollectionAt(Object, UInt32, Object) Metodo

Definizione

Inserisce un valore nell'insieme IXamlDirect specificato in corrispondenza dell'indice specificato.

Questa documentazione si applica a WinUI 2 per la piattaforma UWP (per WinUI nel SDK per app di Windows, vedi gli spazi dei nomi SDK per app di 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)

Parametri

xamlDirectObject
Object

Platform::Object

IInspectable

Fa riferimento all'insieme IXamlDirect specifico.

index
UInt32

unsigned int

uint32_t

Fa riferimento all'indice nella raccolta in cui deve essere inserito il valore specificato.

value
Object

Platform::Object

IInspectable

Fa riferimento al valore IXamlDirect da aggiungere alla raccolta.

Esempio

L'esempio seguente mostra come inserire un valore in una raccolta in un indice specifico usando le 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);

Si applica a

Vedi anche