TableItemPattern.Pattern 字段

定义

标识 TableItemPattern 控件模式。

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 

字段值

示例

在以下示例中 TableItemPattern ,从 AutomationElement获取控件模式。

///--------------------------------------------------------------------
/// <summary>
/// Obtains a TableItemPattern control pattern from an 
/// AutomationElement.
/// </summary>
/// <param name="targetControl">
/// The AutomationElement of interest.
/// </param>
/// <returns>
/// A TableItemPattern object.
/// </returns>
///--------------------------------------------------------------------
private TableItemPattern GetTableItemPattern(
    AutomationElement targetControl)
{
    TableItemPattern tableItemPattern = null;

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

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

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

    Return tableItemPattern

End Function 'GetTableItemPattern

注解

此标识符由UI 自动化客户端应用程序使用。 UI 自动化提供程序应使用 中的TableItemPatternIdentifiers等效字段。

模式标识符将传递给等 GetCurrentPattern 方法,以便从指定的 AutomationElement检索感兴趣的控件模式。

适用于

另请参阅