AutomationProperty AutomationProperty AutomationProperty AutomationProperty Class

정의

AutomationElement의 속성을 식별합니다.Identifies a property of an 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
상속
AutomationPropertyAutomationPropertyAutomationPropertyAutomationProperty

예제

다음 예제에서는 속성 변경 이벤트 처리기를 추가 하 고 처리기 검사는 Property 변경 된 속성을 결정 하는 이벤트 인수의 멤버입니다.The following example adds a property-changed event handler, and the handler checks the Property member of the event arguments to determine the property that has been changed.


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

설명

이 클래스는 속성의 값이 아닌 속성을 식별합니다.This class identifies properties, not the values of properties. 이 형식의 정적 개체의 필드로 있습니다 AutomationElement 및 컨트롤 패턴 클래스입니다.Static objects of this type are found as fields of AutomationElement and control pattern classes.

메서드

CompareTo(Object) CompareTo(Object) CompareTo(Object) CompareTo(Object)

AutomationIdentifier를 다른 AutomationIdentifier와 비교합니다.Compares this AutomationIdentifier with another AutomationIdentifier.

(Inherited from AutomationIdentifier)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

지정된 AutomationIdentifier가 이 AutomationIdentifier와 같은지 여부를 나타내는 값을 반환합니다.Returns a value indicating whether the supplied AutomationIdentifier is equivalent to this AutomationIdentifier.

(Inherited from AutomationIdentifier)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

UI 자동화UI Automation 식별자의 해시 코드를 반환합니다.Returns the hash code for this UI 자동화UI Automation identifier.

(Inherited from AutomationIdentifier)
GetType() GetType() GetType() GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(Inherited from Object)
LookupById(Int32) LookupById(Int32) LookupById(Int32) LookupById(Int32)

지정된 숫자 식별자를 캡슐화하는 AutomationProperty를 검색합니다.Retrieves an AutomationProperty that encapsulates a specified numerical identifier.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(Inherited from Object)

속성

Id Id Id Id

내부 숫자 식별자를 가져옵니다.Gets the underlying numerical identifier.

(Inherited from AutomationIdentifier)
ProgrammaticName ProgrammaticName ProgrammaticName ProgrammaticName

등록된 프로그래밍 이름을 가져옵니다.Gets the registered programmatic name.

(Inherited from AutomationIdentifier)

적용 대상

추가 정보