IXamlDirect.GetCollectionCount(Object) メソッド

定義

指定した IXamlDirect コレクション内の項目の数を返します。

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

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

パラメーター

xamlDirectObject
Object

Platform::Object

IInspectable

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

戻り値

UInt32

unsigned int

uint32_t

項目の数。

次の例は、IXamlDirect のインスタンスを介して Panel.Children の数を取得する方法を示しています。

XamlDirect xd = XamlDirect.GetDefault();

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

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

uint count = xd.GetCollectionCount(childrenCollection);
XamlDirect^ xd = XamlDirect::GetDefault();

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

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

UINT count = xd->GetCollectionCount(childrenCollection);

適用対象