XamlDirect.InsertIntoCollectionAt(IXamlDirectObject, UInt32, IXamlDirectObject) XamlDirect.InsertIntoCollectionAt(IXamlDirectObject, UInt32, IXamlDirectObject) XamlDirect.InsertIntoCollectionAt(IXamlDirectObject, UInt32, IXamlDirectObject) XamlDirect.InsertIntoCollectionAt(IXamlDirectObject, UInt32, IXamlDirectObject) Method

Definition

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

public : void InsertIntoCollectionAt(IXamlDirectObject xamlDirectObject, unsigned int index, IXamlDirectObject value)
void InsertIntoCollectionAt(IXamlDirectObject xamlDirectObject, uint32_t index, IXamlDirectObject value) const;
public void InsertIntoCollectionAt(IXamlDirectObject xamlDirectObject, UInt32 index, IXamlDirectObject value)
Public Sub InsertIntoCollectionAt(xamlDirectObject As IXamlDirectObject, index As UInt32, value As IXamlDirectObject)

Parameters

xamlDirectObject
IXamlDirectObject IXamlDirectObject

Refers to the specific IXamlDirectObject collection.

index
UInt32 UInt32

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

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