共用方式為


TablePattern.RowHeadersProperty 欄位

定義

識別可取得資料表之資料列標頭集合的屬性。

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

欄位值

範例

在下列範例中,會擷取代表資料表之主要資料列或資料行標頭的物件陣列 AutomationElement

為了本範例的目的,會示範 屬性與資料列和資料行標頭專案之間的 RowOrColumnMajor 關聯性。 不過,不論資料表的 屬性為何 RowOrColumnMajor ,資料表都可以有資料列和資料行標頭。

///--------------------------------------------------------------------
/// <summary>
/// Obtains an array of primary table headers.
/// </summary>
/// <param name="targetControl">
/// The target control of interest.
/// </param>
/// <param name="roworcolumnMajor">
/// The RowOrColumnMajor specifier.
/// </param>
/// <returns>
/// An array of automation elements.
/// </returns>
///--------------------------------------------------------------------
private AutomationElement[] GetPrimaryHeaders(
    AutomationElement targetControl, RowOrColumnMajor roworcolumnMajor)
{
    if (targetControl == null)
    {
        throw new ArgumentException("Target element cannot be null.");
    }

    try
    {
        if (roworcolumnMajor ==
            RowOrColumnMajor.RowMajor)
        {
            return targetControl.GetCurrentPropertyValue(
                TablePattern.RowHeadersProperty) as AutomationElement[];
        }

        if (roworcolumnMajor ==
            RowOrColumnMajor.ColumnMajor)
        {
            return targetControl.GetCurrentPropertyValue(
                TablePattern.ColumnHeadersProperty) as AutomationElement[];
        }
    }
    catch (InvalidOperationException)
    {
        // TablePattern not supported.
        // TO DO: error processing.
    }

    return null;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains an array of primary table headers.
''' </summary>
''' <param name="targetControl">
''' The target control of interest.
''' </param>
''' <param name="roworcolumnMajor">
''' The RowOrColumnMajor specifier.
''' </param>
''' <returns>
''' Automation element array objects.
''' </returns>
'''--------------------------------------------------------------------
Private Overloads Function GetPrimaryHeaders( _
ByVal targetControl As AutomationElement, _
ByVal roworcolumnMajor As RowOrColumnMajor) As AutomationElement()
    If targetControl Is Nothing Then
        Throw New ArgumentException("Target element cannot be null.")
    End If

    Try
        If roworcolumnMajor = roworcolumnMajor.RowMajor Then
            Return DirectCast(targetControl.GetCurrentPropertyValue( _
            TablePattern.RowHeadersProperty), AutomationElement())
        End If

        If roworcolumnMajor = roworcolumnMajor.ColumnMajor Then
            Return DirectCast(targetControl.GetCurrentPropertyValue( _
            TablePattern.ColumnHeadersProperty), AutomationElement())
        End If
    Catch exc As InvalidOperationException
        ' TablePattern not supported.
        ' TO DO: error processing.
    End Try

    Return Nothing

End Function 'GetPrimaryHeaders

備註

消費者介面自動化用戶端應用程式會使用此識別碼。 消費者介面自動化提供者應該使用 中的 TablePatternIdentifiers 對等欄位。

傳回的標頭順序會在提供者內一致,但不一定跨提供者。

此屬性不存在於 中 TablePattern.TablePatternInformation ,而且必須使用 或 GetCachedPropertyValueGetCurrentPropertyValue 擷取。

適用於

另請參閱