IXamlDirect.RemoveFromCollectionAt(Object, UInt32) 方法

定义

尝试从指定索引处的 IXamlDirect 集合中删除值。

本文档适用于 Windows 应用 SDKWinUI 的 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);

适用于

另请参阅