StructureChangedEventArgs(StructureChangeType, Int32[]) 생성자

정의

변경 형식과 구조가 변경된 요소의 StructureChangeType ID(식별자)를 지정하여 클래스의 새 인스턴스를 초기화합니다.

public:
 StructureChangedEventArgs(System::Windows::Automation::StructureChangeType structureChangeType, cli::array <int> ^ runtimeId);
public StructureChangedEventArgs(System.Windows.Automation.StructureChangeType structureChangeType, int[] runtimeId);
new System.Windows.Automation.StructureChangedEventArgs : System.Windows.Automation.StructureChangeType * int[] -> System.Windows.Automation.StructureChangedEventArgs
Public Sub New (structureChangeType As StructureChangeType, runtimeId As Integer())

매개 변수

structureChangeType
StructureChangeType

변경 유형을 지정하는 단일 값입니다.

runtimeId
Int32[]

구조가 변경된 UI 자동화 요소의 런타임 식별자(ID)입니다.

예제

다음 예제에서는 자식이 사용자 지정 목록 상자에 추가되거나 제거될 때 이벤트를 생성하고 발생하는 방법을 보여줍니다.

/// <summary>
/// Responds to an addition to the UI Automation tree structure by raising an event.
/// </summary>
/// <param name="list">
/// The list to which the item was added.
/// </param>
/// <remarks>
/// For the runtime Id of the item, pass 0 because the provider cannot know
/// what its actual runtime Id is.
/// </remarks>
public static void OnStructureChangeAdd(CustomListControl list)
{
    if (AutomationInteropProvider.ClientsAreListening)
    {
        int[] fakeRuntimeId = { 0 };
        StructureChangedEventArgs args =
            new StructureChangedEventArgs(StructureChangeType.ChildrenBulkAdded, 
            fakeRuntimeId);
        AutomationInteropProvider.RaiseStructureChangedEvent(
            (IRawElementProviderSimple)list.Provider, args);
    }
}

/// <summary>
/// Responds to a removal from the UI Automation tree structure 
/// by raising an event.
/// </summary>
/// <param name="list">
/// The list from which the item was removed.
/// </param>
/// <remarks>
/// For the runtime Id of the list, pass 0 because the provider cannot know
/// what its actual runtime ID is.
/// </remarks>
public static void OnStructureChangeRemove(CustomListControl list)
{
    if (AutomationInteropProvider.ClientsAreListening)
    {
        int[] fakeRuntimeId = { 0 };
        StructureChangedEventArgs args =
            new StructureChangedEventArgs(StructureChangeType.ChildrenBulkRemoved, 
            fakeRuntimeId);
        AutomationInteropProvider.RaiseStructureChangedEvent(
            (IRawElementProviderSimple)list.Provider, args);
    }
}
''' <summary>
''' Responds to an addition to the UI Automation tree structure by raising an event.
''' </summary>
''' <param name="list">
''' The list to which the item was added.
''' </param>
''' <remarks>
''' For the runtime Id of the item, pass 0 because the provider cannot know
''' what its actual runtime Id is.
''' </remarks>
Public Shared Sub OnStructureChangeAdd(ByVal list As CustomListControl)
    If AutomationInteropProvider.ClientsAreListening Then
        Dim fakeRuntimeId(1) As Integer
        fakeRuntimeId(0) = 0
        Dim args As New StructureChangedEventArgs( _
            StructureChangeType.ChildrenBulkAdded, fakeRuntimeId)
        AutomationInteropProvider.RaiseStructureChangedEvent( _
            CType(list.Provider, IRawElementProviderSimple), args)
    End If

End Sub


''' <summary>
''' Responds to a removal from the UI Automation tree structure by raising an event.
''' </summary>
''' <param name="list">
''' The list from which the item was removed.
''' </param>
''' <remarks>
''' For the runtime Id of the list, pass 0 because the provider cannot know
''' what its actual runtime ID is.
''' </remarks>
Public Shared Sub OnStructureChangeRemove(ByVal list As CustomListControl)
    If AutomationInteropProvider.ClientsAreListening Then
        Dim fakeRuntimeId(1) As Integer
        fakeRuntimeId(0) = 0
        Dim args As New StructureChangedEventArgs( _
            StructureChangeType.ChildrenBulkRemoved, fakeRuntimeId)
        AutomationInteropProvider.RaiseStructureChangedEvent( _
            CType(list.Provider, IRawElementProviderSimple), args)
    End If

End Sub

설명

structureChangeType 반환할 수 있는 값은 UI 자동화 공급자의 구현에 따라 달라집니다. 예를 들어 항목이 Win32 목록 상자에 추가되거나 제거될 때 공급자가 추가 또는 제거된 항목 수를 확인할 수 없는 경우 지정하거나 지정 ChildrenInvalidated 하지 않을 ChildAddedChildRemoved수 있습니다.

다음 표에서는 다양한 구조 변경에 대해 StructureChangedEventHandler 수신된 이벤트의 정보를 설명합니다.

structureChangeType 이벤트 원본 runtimeId
ChildAdded 추가된 자식입니다. 추가된 자식입니다.
ChildRemoved 제거된 자식의 부모입니다. 제거된 자식입니다.
ChildrenBulkAdded 추가된 자식의 부모입니다. 추가된 자식의 부모입니다.
ChildrenBulkRemoved 제거된 자식의 부모입니다. 제거된 자식의 부모입니다.
ChildrenInvalidated 무효화된 자식의 부모입니다. 무효화된 자식의 부모

사용자 지정 컨트롤에서 의미 있는 값을 제공하지 못할 수 있습니다 runtimeId. 자세한 내용은 RaiseStructureChangedEvent를 참조하세요.

적용 대상

추가 정보