ExpandCollapsePattern.Pattern 필드

정의

컨트롤 패턴을 식별합니다 ExpandCollapsePattern .

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

필드 값

예제

다음 예제에서는 UI 자동화 요소에서 ExpandCollapsePattern 컨트롤 패턴을 가져옵니다.

///--------------------------------------------------------------------
/// <summary>
/// Obtains an ExpandCollapsePattern control pattern from an 
/// automation element.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// A ExpandCollapsePattern object.
/// </returns>
///--------------------------------------------------------------------
private ExpandCollapsePattern GetExpandCollapsePattern(
    AutomationElement targetControl)
{
    ExpandCollapsePattern expandCollapsePattern = null;

    try
    {
        expandCollapsePattern =
            targetControl.GetCurrentPattern(
            ExpandCollapsePattern.Pattern)
            as ExpandCollapsePattern;
    }
    // Object doesn't support the ExpandCollapsePattern control pattern.
    catch (InvalidOperationException)
    {
        return null;
    }

    return expandCollapsePattern;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains an ExpandCollapsePattern control pattern from an 
''' automation element.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' A ExpandCollapsePattern object.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetExpandCollapsePattern( _
ByVal targetControl As AutomationElement) As ExpandCollapsePattern
    Dim expandCollapsePattern As ExpandCollapsePattern = Nothing

    Try
        expandCollapsePattern = DirectCast( _
        targetControl.GetCurrentPattern(expandCollapsePattern.Pattern), _
        ExpandCollapsePattern)
    Catch exc As InvalidOperationException
        ' Object doesn't support the ExpandCollapsePattern control pattern.
        Return Nothing
    End Try

    Return expandCollapsePattern

End Function 'GetExpandCollapsePattern

설명

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

패턴 식별자(ID)는 지정된 컨트롤에서 관심 있는 컨트롤 패턴을 검색하는 등의 GetCurrentPattern 메서드에 전달됩니다 AutomationElement.

적용 대상

추가 정보