XamlDirect.RemoveFromCollection(IXamlDirectObject, IXamlDirectObject) XamlDirect.RemoveFromCollection(IXamlDirectObject, IXamlDirectObject) XamlDirect.RemoveFromCollection(IXamlDirectObject, IXamlDirectObject) XamlDirect.RemoveFromCollection(IXamlDirectObject, IXamlDirectObject) Method

Definition

Tries to remove a value from the specified IXamlDirectObject collection.

public : Platform::Boolean RemoveFromCollection(IXamlDirectObject xamlDirectObject, IXamlDirectObject value)
bool RemoveFromCollection(IXamlDirectObject xamlDirectObject, IXamlDirectObject value) const;
public bool RemoveFromCollection(IXamlDirectObject xamlDirectObject, IXamlDirectObject value)
Public Function RemoveFromCollection(xamlDirectObject As IXamlDirectObject, value As IXamlDirectObject) As bool

Parameters

xamlDirectObject
IXamlDirectObject IXamlDirectObject

Refers to the specific IXamlDirectObject collection.

value
IXamlDirectObject IXamlDirectObject

Refers to the IXamlDirectObject value to remove from the collection.

Returns

bool bool

true if value was present. false if value was not present.

Examples

The following example shows how to remove a value from a collection using XamlDirect APIs.

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.RemoveFromCollection(childrenCollection, button); // Should return true
xd.RemoveFromCollection(childrenCollection, button); // Should return false
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->RemoveFromCollection(childrenCollection, button); // Should return true
xd->RemoveFromCollection(childrenCollection, button); // Should return false