XamlDirect.ClearCollection(IXamlDirectObject) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从指定的 IXamlDirectObject 集合中删除所有项。
public:
virtual void ClearCollection(IXamlDirectObject ^ xamlDirectObject) = ClearCollection;
void ClearCollection(IXamlDirectObject const& xamlDirectObject);
public void ClearCollection(IXamlDirectObject xamlDirectObject);
function clearCollection(xamlDirectObject)
Public Sub ClearCollection (xamlDirectObject As IXamlDirectObject)
参数
- xamlDirectObject
- IXamlDirectObject
引用特定的 IXamlDirectObject 集合。
示例
以下示例演示如何添加 以使用 ClearCollection 方法清除指定 IXamlDirectObject 指向的集合。
XamlDirect xd = XamlDirect.GetDefault();
IXamlDirectObject relativePanel = xd.CreateInstance(XamlTypeIndex.RelativePanel);
IXamlDirectObject childrenCollection = xd.GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex.Panel_Children);
IXamlDirectObject button = xd.CreateInstance(XamlTypeIndex.Button);
xd.AddToCollection(childrenCollection, button);
xd.ClearCollection(childrenCollection);
XamlDirect^ xd = XamlDirect::GetDefault();
IXamlDirectObject^ relativePanel = xd->CreateInstance(XamlTypeIndex::RelativePanel);
IXamlDirectObject^ childrenCollection = xd->GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex::Panel_Children);
IXamlDirectObject^ button = xd->CreateInstance(XamlTypeIndex::Button);
xd->AddToCollection(childrenCollection, button);
xd->ClearCollection(childrenCollection);