IXamlDirect.GetCollectionCount(Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回指定 IXamlDirect 集合中的项计数。
本文档适用于 Windows 应用 SDK 中 WinUI 的 WinUI 2 for UWP (,请参阅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 集合。
返回
项计数。
示例
以下示例演示如何通过 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);