SelectionItemPattern.ElementSelectedEvent Field
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.
Identifies the event that is raised when a call to any of Select(), AddToSelection(), or RemoveFromSelection() results in a single item being selected.
public: static initonly System::Windows::Automation::AutomationEvent ^ ElementSelectedEvent;
public static readonly System.Windows.Automation.AutomationEvent ElementSelectedEvent;
staticval mutable ElementSelectedEvent : System.Windows.Automation.AutomationEvent
Public Shared ReadOnly ElementSelectedEvent As AutomationEvent
Field Value
Examples
In the following example, event listeners are declared for the SelectionItemPattern events.
///--------------------------------------------------------------------
/// <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
Remarks
This identifier is used by UI Automation client applications. UI Automation providers should use the equivalent field in SelectionItemPatternIdentifiers.
Applies to
שתף איתנו פעולה ב- GitHub
ניתן למצוא את המקור לתוכן זה ב- GitHub, שם ניתן גם ליצור ולסקור בעיות ולמשוך בקשות. לקבלת מידע נוסף, עיין במדריך התורמים שלנו.