Share via


XamlDirect.ClearCollection(IXamlDirectObject) Method

Definition

Removes all items from the specified IXamlDirectObject collection.

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)

Parameters

xamlDirectObject
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);

Applies to

See also