XamlDirect.GetCollectionCount(IXamlDirectObject) 方法

定义

返回指定 IXamlDirectObject 集合中的项计数。

public:
 virtual unsigned int GetCollectionCount(IXamlDirectObject ^ xamlDirectObject) = GetCollectionCount;
uint32_t GetCollectionCount(IXamlDirectObject const& xamlDirectObject);
public uint GetCollectionCount(IXamlDirectObject xamlDirectObject);
function getCollectionCount(xamlDirectObject)
Public Function GetCollectionCount (xamlDirectObject As IXamlDirectObject) As UInteger

参数

xamlDirectObject
IXamlDirectObject

引用特定的 IXamlDirectObject 集合。

返回

UInt32

unsigned int

uint32_t

项计数。

示例

以下示例演示如何通过 IXamlDirectObject 的 实例获取 Panel.Children 的计数。

XamlDirect xd = XamlDirect.GetDefault();

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

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

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

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

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

UINT count = xd->GetCollectionCount(childrenCollection);

适用于