XamlDirect.ClearCollection(IXamlDirectObject) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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);