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 목록 상자에 추가되거나 제거될 때 공급자가 추가 또는 제거된 항목 수를 확인할 수 없는 경우 항목을 지정하거나 ChildRemoved지정 ChildrenInvalidated 하지 않을 ChildAdded 수 있습니다.

다음 표에서 정보를 수신한 경우에 StructureChangedEventHandler 다른 구조 변경 사항에 대 한 합니다.

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

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

적용 대상

추가 정보