XamlDirect.RemoveFromCollection(IXamlDirectObject, 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.
Tries to remove a value from the specified IXamlDirectObject collection.
public:
virtual bool RemoveFromCollection(IXamlDirectObject ^ xamlDirectObject, IXamlDirectObject ^ value) = RemoveFromCollection;
bool RemoveFromCollection(IXamlDirectObject const& xamlDirectObject, IXamlDirectObject const& value);
public bool RemoveFromCollection(IXamlDirectObject xamlDirectObject, IXamlDirectObject value);
function removeFromCollection(xamlDirectObject, value)
Public Function RemoveFromCollection (xamlDirectObject As IXamlDirectObject, value As IXamlDirectObject) As Boolean
Parameters
- xamlDirectObject
- IXamlDirectObject
Refers to the specific IXamlDirectObject collection.
- value
- IXamlDirectObject
Refers to the IXamlDirectObject value to remove from the collection.
Returns
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
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for