AutomationProperty 클래스

정의

AutomationElement의 속성을 식별합니다.

public ref class AutomationProperty : System::Windows::Automation::AutomationIdentifier
public class AutomationProperty : System.Windows.Automation.AutomationIdentifier
type AutomationProperty = class
    inherit AutomationIdentifier
Public Class AutomationProperty
Inherits AutomationIdentifier
상속
AutomationProperty

예제

다음 예제에서는 속성 변경 이벤트 처리기를 추가 하 고 처리기 검사는 Property 변경 된 속성을 결정 하는 이벤트 인수의 멤버입니다.


AutomationPropertyChangedEventHandler propChangeHandler;
/// <summary>
/// Adds a handler for property-changed event; in particular, a change in the enabled state.
/// </summary>
/// <param name="element">The UI Automation element whose state is being monitored.</param>
public void SubscribePropertyChange(AutomationElement element)
{
    Automation.AddAutomationPropertyChangedEventHandler(element, 
        TreeScope.Element, 
        propChangeHandler = new AutomationPropertyChangedEventHandler(OnPropertyChange),
        AutomationElement.IsEnabledProperty);
}

/// <summary>
/// Handler for property changes.
/// </summary>
/// <param name="src">The source whose properties changed.</param>
/// <param name="e">Event arguments.</param>
private void OnPropertyChange(object src, AutomationPropertyChangedEventArgs e)
{
    AutomationElement sourceElement = src as AutomationElement;
    if (e.Property == AutomationElement.IsEnabledProperty)
    {
        bool enabled = (bool)e.NewValue;
        // TODO: Do something with the new value. 
        // The element that raised the event can be identified by its runtime ID property.
    }
    else
    { 
        // TODO: Handle other property-changed events.
    }
}

public void UnsubscribePropertyChange(AutomationElement element)
{
    if (propChangeHandler != null)
    {
        Automation.RemoveAutomationPropertyChangedEventHandler(element, propChangeHandler);
    }
}

Dim propChangeHandler As AutomationPropertyChangedEventHandler

''' <summary>
''' Adds a handler for property-changed event; in particular, a change in the enabled state.
''' </summary>
''' <param name="element">The UI Automation element whose state is being monitored.</param>
Public Sub SubscribePropertyChange(ByVal element As AutomationElement)
    propChangeHandler = _
        New AutomationPropertyChangedEventHandler(AddressOf OnPropertyChange)
    Automation.AddAutomationPropertyChangedEventHandler(element, TreeScope.Element, _
        propChangeHandler, AutomationElement.IsEnabledProperty)

End Sub



''' <summary>
''' Handler for property changes.
''' </summary>
''' <param name="src">The source whose properties changed.</param>
''' <param name="e">Event arguments.</param>
Private Sub OnPropertyChange(ByVal src As Object, ByVal e As AutomationPropertyChangedEventArgs) 
    Dim sourceElement As AutomationElement = DirectCast(src, AutomationElement)
    If e.Property Is AutomationElement.IsEnabledProperty Then
        Dim enabled As Boolean = CBool(e.NewValue)
        ' TODO: Do something with the new value. 
        ' The element that raised the event can be identified by its runtime ID property.
    Else
    End If
 ' TODO: Handle other property-changed events.
End Sub


Public Sub UnsubscribePropertyChange(ByVal element As AutomationElement)
    If (propChangeHandler IsNot Nothing) Then
        Automation.RemoveAutomationPropertyChangedEventHandler(element, propChangeHandler)
    End If

End Sub

설명

이 클래스는 속성의 값이 아닌 속성을 식별합니다. 이 형식의 정적 개체의 필드로 있습니다 AutomationElement 및 컨트롤 패턴 클래스입니다.

속성

Id

내부 숫자 식별자를 가져옵니다.

(다음에서 상속됨 AutomationIdentifier)
ProgrammaticName

등록된 프로그래밍 이름을 가져옵니다.

(다음에서 상속됨 AutomationIdentifier)

메서드

CompareTo(Object)

AutomationIdentifier를 다른 AutomationIdentifier와 비교합니다.

(다음에서 상속됨 AutomationIdentifier)
Equals(Object)

지정된 AutomationIdentifier가 이 AutomationIdentifier와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 AutomationIdentifier)
GetHashCode()

이 UI 자동화 식별자에 대한 해시 코드를 반환합니다.

(다음에서 상속됨 AutomationIdentifier)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
LookupById(Int32)

지정된 숫자 식별자를 캡슐화하는 AutomationProperty를 검색합니다.

MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보