Compartilhar via


IXamlDirect.GetCollectionCount(Object) Método

Definição

Retorna a contagem de itens na coleção IXamlDirect especificada.

Esta documentação se aplica ao WinUI 2 para UWP (para WinUI no SDK do Aplicativo Windows, consulte os namespaces SDK do Aplicativo Windows).

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

Parâmetros

xamlDirectObject
Object

Platform::Object

IInspectable

Refere-se à coleção IXamlDirect específica.

Retornos

UInt32

unsigned int

uint32_t

Contagem de itens.

Exemplos

O exemplo a seguir mostra como obter a contagem de Panel.Children por meio da instância do IXamlDirect.

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

Aplica-se a