TogglePattern.ToggleStateProperty 필드

정의

ToggleState 속성을 식별합니다.

public: static initonly System::Windows::Automation::AutomationProperty ^ ToggleStateProperty;
public static readonly System.Windows.Automation.AutomationProperty ToggleStateProperty;
 staticval mutable ToggleStateProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ToggleStateProperty As AutomationProperty 

필드 값

AutomationProperty

예제

다음 예제에서는 루트 요소를 루트의 후손이 및 속성 조건 집합을 만족 하는 자동화 요소의 컬렉션을 반환 하는 함수에 전달 됩니다.

///--------------------------------------------------------------------
/// <summary>
/// Finds all automation elements that satisfy 
/// the specified condition(s).
/// </summary>
/// <param name="rootElement">
/// The automation element from which to start searching.
/// </param>
/// <returns>
/// A collection of automation elements satisfying 
/// the specified condition(s).
/// </returns>
///--------------------------------------------------------------------
private AutomationElementCollection FindAutomationElement(
    AutomationElement rootElement)
{
    if (rootElement == null)
    {
        throw new ArgumentException("Root element cannot be null.");
    }

    PropertyCondition conditionOn =
        new PropertyCondition(
        TogglePattern.ToggleStateProperty, ToggleState.On);

    PropertyCondition conditionIndeterminate =
        new PropertyCondition(
        TogglePattern.ToggleStateProperty, ToggleState.Indeterminate);

    // Use any combination of the preceding condtions to 
    // find the control(s) of interest
    OrCondition condition = new OrCondition(
        conditionOn,
        conditionIndeterminate);

    return rootElement.FindAll(TreeScope.Descendants, condition);
}
'''--------------------------------------------------------------------
''' <summary>
''' Finds all automation elements that satisfy 
''' the specified condition(s).
''' </summary>
''' <param name="rootElement">
''' The automation element from which to start searching.
''' </param>
''' <returns>
''' A collection of automation elements satisfying 
''' the specified condition(s).
''' </returns>
'''--------------------------------------------------------------------
Private Function FindAutomationElement( _
ByVal rootElement As AutomationElement) As AutomationElementCollection
    If rootElement Is Nothing Then
        Throw New ArgumentException("Root element cannot be null.")
    End If

    Dim conditionOn As New PropertyCondition( _
    TogglePattern.ToggleStateProperty, ToggleState.On)

    Dim conditionIndeterminate As New PropertyCondition( _
    TogglePattern.ToggleStateProperty, ToggleState.Indeterminate)

    ' Use any combination of the preceding condtions to 
    ' find the control(s) of interest
    Dim condition As OrCondition = _
    New OrCondition(conditionOn, conditionIndeterminate)

    Return rootElement.FindAll(TreeScope.Descendants, condition)

End Function 'FindAutomationElement

설명

이 식별자는 UI 자동화 클라이언트 애플리케이션에서 사용 됩니다. UI 자동화 공급자의 해당 필드를 사용 해야 TogglePatternIdentifiers합니다.

AutomationElement 순환 해야 합니다 해당 ToggleState 순서로: OnOff 지원 하는 경우 Indeterminate합니다.

적용 대상