TableItemPattern.ColumnHeaderItemsProperty 字段

定义

标识一个属性,该属性可检索与表项或单元格关联的所有列标题。

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

字段值

AutomationProperty

示例

在下面的示例中,检索表示表的主行或列标题项的自动化元素对象的数组。

本示例演示了属性与行标题项和列标题项之间的关系 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 AutomationElement array object.
/// </returns>
///--------------------------------------------------------------------
private Object GetPrimaryHeaders(
    AutomationElement targetControl, RowOrColumnMajor roworcolumnMajor)
{
    if (targetControl == null)
    {
        throw new ArgumentException("Target element cannot be null.");
    }

    try
    {
        if (roworcolumnMajor ==
            RowOrColumnMajor.RowMajor)
        {
            return targetControl.GetCurrentPropertyValue(
                TableItemPattern.RowHeaderItemsProperty);
        }

        if (roworcolumnMajor ==
            RowOrColumnMajor.ColumnMajor)
        {
            return targetControl.GetCurrentPropertyValue(
                TableItemPattern.ColumnHeaderItemsProperty);
        }
    }
    catch (InvalidOperationException)
    {
        // TableItemPattern 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>
    ''' An AutomationElement array object.
    ''' </returns>
    '''--------------------------------------------------------------------
    Private Function GetPrimaryHeaders( _
    ByVal targetControl As AutomationElement, _
    ByVal roworcolumnMajor As RowOrColumnMajor) As [Object]
        If targetControl Is Nothing Then
            Throw New ArgumentException("Target element cannot be null.")
        End If

        Try
            If roworcolumnMajor = roworcolumnMajor.RowMajor Then
                Return targetControl.GetCurrentPropertyValue( _
                TableItemPattern.RowHeaderItemsProperty)
            End If

            If roworcolumnMajor = roworcolumnMajor.ColumnMajor Then
                Return targetControl.GetCurrentPropertyValue( _
                TableItemPattern.ColumnHeaderItemsProperty)
            End If
        Catch
        End Try
        ' TableItemPattern not supported.
        ' TO DO: error processing.

        Return Nothing

    End Function 'GetPrimaryHeaders
End Class

注解

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

此属性不存在, TableItemPattern.TableItemPatternInformation 必须使用 GetCurrentPropertyValueGetCachedPropertyValue检索此属性。

适用于

另请参阅