Share via


XamlDirect.InsertIntoCollectionAt Method

Definition

Inserts a value into the specified IXamlDirectObject collection at the specified index.

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)

Parameters

xamlDirectObject
IXamlDirectObject

Refers to the specific IXamlDirectObject collection.

index
UInt32

unsigned int

uint32_t

Refers to the index in the collection where the specified value must be inserted.

value
IXamlDirectObject

Refers to the IXamlDirectObject value to add to the collection.

Examples

The following example shows how to insert a value into a collection at a specific index using XamlDirect APIs.

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

Applies to

See also