Compartir vía


SelectionItemPattern.ElementRemovedFromSelectionEvent Campo

Definición

Identifica el evento que se desencadena cuando se quita un elemento de una colección de elementos seleccionados.

public: static initonly System::Windows::Automation::AutomationEvent ^ ElementRemovedFromSelectionEvent;
public static readonly System.Windows.Automation.AutomationEvent ElementRemovedFromSelectionEvent;
 staticval mutable ElementRemovedFromSelectionEvent : System.Windows.Automation.AutomationEvent
Public Shared ReadOnly ElementRemovedFromSelectionEvent As AutomationEvent 

Valor de campo

Ejemplos

En el ejemplo siguiente, los agentes de escucha de eventos se declaran para los SelectionItemPattern eventos.

///--------------------------------------------------------------------
/// <summary>
/// Subscribe to the selection item events of interest.
/// </summary>
/// <param name="selectionItem">
/// Automation element that supports SelectionItemPattern and is 
/// a child of a selection container that supports SelectionPattern
/// </param>
/// <remarks>
/// The events are raised by the SelectionItem elements, 
/// not the Selection container.
/// </remarks>
///--------------------------------------------------------------------
private void SetSelectionEventHandlers
    (AutomationElement selectionItem)
{
    AutomationEventHandler selectionHandler =
        new AutomationEventHandler(SelectionHandler);

    Automation.AddAutomationEventHandler(
        SelectionItemPattern.ElementSelectedEvent,
        selectionItem,
        TreeScope.Element,
        SelectionHandler);
    Automation.AddAutomationEventHandler(
        SelectionItemPattern.ElementAddedToSelectionEvent,
        selectionItem,
        TreeScope.Element,
        SelectionHandler);
    Automation.AddAutomationEventHandler(
        SelectionItemPattern.ElementRemovedFromSelectionEvent,
        selectionItem,
        TreeScope.Element,
        SelectionHandler);
}

private void SelectionHandler(object src, AutomationEventArgs e)
{
    // TODO: event handling
}
'''--------------------------------------------------------------------
''' <summary>
''' Subscribe to the selection item events of interest.
''' </summary>
''' <param name="selectionItem">
''' Automation element that supports SelectionItemPattern and is 
''' a child of a selection container that supports SelectionPattern
''' </param>
''' <remarks>
''' The events are raised by the SelectionItem elements, 
''' not the Selection container.
''' </remarks>
'''--------------------------------------------------------------------
Private Sub SetSelectionEventHandlers( _
ByVal selectionItem As AutomationElement)
    Dim selectionHandler As AutomationEventHandler = _
    New AutomationEventHandler(AddressOf OnSelectionHandler)

    Automation.AddAutomationEventHandler( _
    SelectionItemPattern.ElementSelectedEvent, _
    selectionItem, TreeScope.Element, selectionHandler)
    Automation.AddAutomationEventHandler( _
    SelectionItemPattern.ElementAddedToSelectionEvent, _
    selectionItem, TreeScope.Element, selectionHandler)
    Automation.AddAutomationEventHandler( _
    SelectionItemPattern.ElementRemovedFromSelectionEvent, _
    selectionItem, TreeScope.Element, selectionHandler)
End Sub


Private Sub OnSelectionHandler(ByVal src As Object, ByVal e As AutomationEventArgs)
    ' TODO: event handling
End Sub

Comentarios

Si el resultado de una RemoveFromSelection llamada es un único elemento seleccionado, se generará un ElementSelectedEvent elemento en su lugar.

Las aplicaciones cliente de Automatización de la interfaz de usuario usan este identificador. Los proveedores de automatización de la interfaz de usuario deben usar el campo equivalente en SelectionItemPatternIdentifiers.

Se aplica a