Export (0) Print
Expand All

TablePattern.RowHeadersProperty Field

Identifies the property that gets the collection of row headers for a table.

Namespace:  System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

public static readonly AutomationProperty RowHeadersProperty

This identifier is used by UI Automation client applications. UI Automation providers should use the equivalent field in TablePatternIdentifiers.

The order of the headers returned will be consistent within a provider, but not necessarily across providers.

This property is not present in TablePattern.TablePatternInformation and must be retrieved by using GetCurrentPropertyValue or GetCachedPropertyValue.

In the following example, an array of AutomationElement objects representing the primary row or column headers of a table is retrieved.

For the purposes of this example, a relationship between the RowOrColumnMajor property and the row and column header items is demonstrated. However, a table can have row and column headers regardless of the RowOrColumnMajor property of the table.

///-------------------------------------------------------------------- 
/// <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;
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft