다음을 통해 공유


IXamlDirect.GetCollectionCount(Object) 메서드

정의

지정된 IXamlDirect 컬렉션의 항목 수를 반환합니다.

이 설명서는 UWP용 WinUI 2에 적용됩니다(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);

적용 대상