Condividi tramite


XamlDirect.RemoveFromCollection(IXamlDirectObject, IXamlDirectObject) Metodo

Definizione

Tenta di rimuovere un valore dall'insieme IXamlDirectObject specificato.

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

Parametri

xamlDirectObject
IXamlDirectObject

Fa riferimento all'insieme IXamlDirectObject specifico.

value
IXamlDirectObject

Fa riferimento al valore IXamlDirectObject da rimuovere dalla raccolta.

Restituisce

Boolean

bool

true se il valore era presente. false se il valore non è presente.

Esempio

L'esempio seguente mostra come rimuovere un valore da una raccolta usando le API 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

Si applica a

Vedi anche