XamlDirect.ClearCollection(IXamlDirectObject) XamlDirect.ClearCollection(IXamlDirectObject) XamlDirect.ClearCollection(IXamlDirectObject) XamlDirect.ClearCollection(IXamlDirectObject) Method

Definition

Removes all items from the specified IXamlDirectObject collection.

public : void ClearCollection(IXamlDirectObject xamlDirectObject)
void ClearCollection(IXamlDirectObject xamlDirectObject) const;
public void ClearCollection(IXamlDirectObject xamlDirectObject)
Public Sub ClearCollection(xamlDirectObject As IXamlDirectObject)

Parameters

xamlDirectObject
IXamlDirectObject IXamlDirectObject

Refers to the specific IXamlDirectObject collection.

Examples

The following example shows how to add to use the ClearCollection method to clear a collection pointed to by the specified 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);