다음을 통해 공유


GridPattern.Pattern 필드

정의

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

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 

필드 값

예제

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

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

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

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

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

    Return gridPattern
End Function 'GetGridPattern

설명

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

패턴 식별자를 같은 메서드에 전달 GetCurrentPattern 지정 된 위치에서 원하는 컨트롤 패턴을 검색할 AutomationElement합니다.

적용 대상