共用方式為


IXamlDirect.RemoveFromCollectionAt(Object, UInt32) 方法

定義

嘗試從指定索引處的 IXamlDirect 集合中移除值。

本檔適用于 Windows 應用程式 SDK 中適用于 WinUI 的 WinUI 2 for UWP (,請參閱Windows 應用程式 SDK命名空間) 。

public:
 void RemoveFromCollectionAt(Platform::Object ^ xamlDirectObject, unsigned int index);
void RemoveFromCollectionAt(IInspectable const& xamlDirectObject, uint32_t const& index);
public void RemoveFromCollectionAt(object xamlDirectObject, uint index);
Public Sub RemoveFromCollectionAt (xamlDirectObject As Object, index As UInteger)

參數

xamlDirectObject
Object

Platform::Object

IInspectable

參考特定的 IXamlDirect 集合。

index
UInt32

unsigned int

uint32_t

參考集合中必須移除值的索引。

範例

下列範例示範如何使用 XamlDirect API 從特定索引中移除值。

XamlDirect xd = XamlDirect.GetDefault();

IXamlDirect relativePanel = xd.CreateInstance(XamlTypeIndex.RelativePanel);

IXamlDirect childrenCollection = xd.GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex.Panel_Children);

xd.RemoveFromCollectionAt(childrenCollection, 0);
XamlDirect^ xd = XamlDirect::GetDefault();

IXamlDirect^ relativePanel = xd->CreateInstance(XamlTypeIndex::RelativePanel);

IXamlDirect^ childrenCollection = xd->GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex::Panel_Children);

xd->RemoveFromCollectionAt(childrenCollection, 0);

適用於

另請參閱