共用方式為


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 自動化用戶端應用程式會使用此識別碼。 使用者介面自動化提供者應該使用 中的 SelectionPatternIdentifiers 對等欄位。

適用於