SelectionItemPattern.ElementRemovedFromSelectionEvent Campo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Identifica l'evento generato quando un elemento viene rimosso da una raccolta di elementi selezionati.
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
Valore del campo
Esempio
Nell'esempio seguente i listener di eventi vengono dichiarati per gli SelectionItemPattern eventi.
///--------------------------------------------------------------------
/// <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
Commenti
Se il risultato di una RemoveFromSelection chiamata è un singolo elemento selezionato, verrà invece generato un oggetto ElementSelectedEvent .
Questo identificatore viene usato da Automazione interfaccia utente applicazioni client. Automazione interfaccia utente provider devono usare il campo equivalente in SelectionItemPatternIdentifiers.