Compartilhar via


XamlDirect.RemoveFromCollection(IXamlDirectObject, IXamlDirectObject) Método

Definição

Tenta remover um valor da coleção IXamlDirectObject especificada.

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

Parâmetros

xamlDirectObject
IXamlDirectObject

Refere-se à coleção IXamlDirectObject específica.

value
IXamlDirectObject

Refere-se ao valor IXamlDirectObject a ser removido da coleção.

Retornos

Boolean

bool

true se o valor estava presente. false se o valor não estiver presente.

Exemplos

O exemplo a seguir mostra como remover um valor de uma coleção usando APIs XamlDirect .

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

Aplica-se a

Confira também