TablePattern.RowHeadersProperty Field

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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
Available since 3.0
Return to top
Show: