IXamlDirect.GetXamlDirectObjectFromCollectionAt(Object, UInt32) 方法

定义

从指定的 IXamlDirect 集合返回位于指定索引处的 IXamlDirect 项。

本文档适用于 Windows 应用 SDKWinUI 的 WinUI 2 for UWP (,请参阅Windows 应用 SDK命名空间) 。

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

参数

xamlDirectObject
Object

Platform::Object

IInspectable

指特定的 IXamlDirect 集合。

index
UInt32

unsigned int

uint32_t

引用要获取的项集合中的索引。

返回

Object

Platform::Object

IInspectable

返回集合的指定索引处的 IXamlDirect 项。

示例

以下示例演示如何在集合的指定索引处访问 IXamlDirect 项。

XamlDirect xd = XamlDirect.GetDefault();

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

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

IXamlDirect first = xd.GetXamlDirectObjectFromCollectionAt(childrenCollection, 0);
XamlDirect^ xd = XamlDirect::GetDefault();

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

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

IXamlDirect^ first = xd->GetXamlDirectObjectFromCollectionAt(childrenCollection, 0);

适用于