共用方式為


IXamlDirect.GetXamlDirectObjectFromCollectionAt(Object, UInt32) 方法

定義

從指定的 IXamlDirect 集合傳回位於指定索引處的 IXamlDirect 專案。

本檔適用于 Windows 應用程式 SDK 中適用于 WinUI 的 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);

適用於