Export (0) Print
Expand All

TableItemPattern.RowHeaderItemsProperty Field

Identifies the property that retrieves all the row headers associated with a table item or cell.

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

public static readonly AutomationProperty RowHeaderItemsProperty

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

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

In the following example, an array of automation element objects representing the primary row or column header items 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 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;
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft