IXamlDirect.InsertIntoCollectionAt(Object, UInt32, Object) メソッド

定義

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

このドキュメントは、UWP 用 WinUI 2 に適用されます (Windows アプリ SDKWinUI については、Windows アプリ SDK名前空間を参照してください)。

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)

パラメーター

xamlDirectObject
Object

Platform::Object

IInspectable

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

index
UInt32

unsigned int

uint32_t

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

value
Object

Platform::Object

IInspectable

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

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

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

適用対象

こちらもご覧ください