TablePattern.RowHeadersProperty Field

Definition

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

public static readonly System.Windows.Automation.AutomationProperty RowHeadersProperty;

Field Value

Examples

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

Remarks

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.

Applies to

제품 버전
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also