Share via


IXamlDirect.GetCollectionCount(Object) Method

Definition

Returns the count of items in the specified IXamlDirect collection.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

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

Parameters

xamlDirectObject
Object

Platform::Object

IInspectable

Refers to the specific IXamlDirect collection.

Returns

UInt32

unsigned int

uint32_t

Count of items.

Examples

The following example shows how to get the count of Panel.Children through the IXamlDirect's instance.

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);

Applies to