SelectionPattern.InvalidatedEvent 字段

定义

标识在容器中的选项发生重大更改并需要发送多于 InvalidateLimit 常量所允许的添加和删除事件时引发的事件。

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

字段值

示例

在下面的示例中,为 InvalidatedEvent声明了事件侦听器。

///--------------------------------------------------------------------
/// <summary>
/// Subscribe to the selection events of interest.
/// </summary>
/// <param name="selectionContainer">
/// Automation element that supports SelectionPattern
/// </param>
///--------------------------------------------------------------------
private void SetSelectionEventHandlers
    (AutomationElement selectionContainer)
{            
    AutomationEventHandler selectionInvalidatedHandler =
        new AutomationEventHandler(SelectionInvalidatedHandler);

    Automation.AddAutomationEventHandler(
        SelectionPattern.InvalidatedEvent, 
        selectionContainer, 
        TreeScope.Element, 
        SelectionInvalidatedHandler);
}

///--------------------------------------------------------------------
/// <summary>
/// Selection invalidated event handler.
/// </summary>
/// <param name="src">Object that raised the event.</param>
/// <param name="e">Event arguments.</param>
///--------------------------------------------------------------------
private void SelectionInvalidatedHandler(object src, AutomationEventArgs e)
{
    // TODO: event handling
}
'''--------------------------------------------------------------------
''' <summary>
''' Subscribe to the selection events of interest.
''' </summary>
''' <param name="selectionContainer">
''' Automation element that supports SelectionPattern
''' </param>
'''--------------------------------------------------------------------
Private Sub SetSelectionEventHandlers( _
ByVal selectionContainer As AutomationElement)
    Dim selectionInvalidatedHandler As AutomationEventHandler = _
    New AutomationEventHandler(AddressOf OnSelectionInvalidatedHandler)

    Automation.AddAutomationEventHandler( _
    SelectionPattern.InvalidatedEvent, _
    selectionContainer, TreeScope.Element, selectionInvalidatedHandler)

End Sub

'''--------------------------------------------------------------------
''' <summary>
''' Selection invalidated event handler.
''' </summary>
''' <param name="src">Object that raised the event.</param>
''' <param name="e">Event arguments.</param>
'''--------------------------------------------------------------------
Private Sub OnSelectionInvalidatedHandler( _
ByVal src As Object, ByVal e As AutomationEventArgs)
    ' TODO: event handling
End Sub

注解

当容器中的选择发生重大更改,并且需要发送比常量允许的更多添加和删除事件时, InvalidateLimit 将引发无效事件。

此标识符由 UI 自动化客户端应用程序使用。 UI 自动化提供程序应使用 中的 SelectionPatternIdentifiers等效字段。

适用于