XamlDirect.InsertIntoCollectionAt メソッド

定義

指定したインデックス位置にある指定した IXamlDirectObject コレクションに値を挿入します。

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)

パラメーター

xamlDirectObject
IXamlDirectObject

特定の IXamlDirectObject コレクションを参照します。

index
UInt32

unsigned int

uint32_t

指定した値を挿入する必要があるコレクション内のインデックスを参照します。

value
IXamlDirectObject

コレクションに追加する IXamlDirectObject 値を参照します。

次の例は、 XamlDirect API を使用して、特定のインデックスにあるコレクションに値を挿入する方法を示しています。

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

適用対象

こちらもご覧ください