Szerkesztés

Megosztás a következőn keresztül:


TablePattern.RowHeadersProperty Field

Definition

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

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

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;
}
'''--------------------------------------------------------------------
''' <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>
''' Automation element array objects.
''' </returns>
'''--------------------------------------------------------------------
Private Overloads Function GetPrimaryHeaders( _
ByVal targetControl As AutomationElement, _
ByVal roworcolumnMajor As RowOrColumnMajor) As AutomationElement()
    If targetControl Is Nothing Then
        Throw New ArgumentException("Target element cannot be null.")
    End If

    Try
        If roworcolumnMajor = roworcolumnMajor.RowMajor Then
            Return DirectCast(targetControl.GetCurrentPropertyValue( _
            TablePattern.RowHeadersProperty), AutomationElement())
        End If

        If roworcolumnMajor = roworcolumnMajor.ColumnMajor Then
            Return DirectCast(targetControl.GetCurrentPropertyValue( _
            TablePattern.ColumnHeadersProperty), AutomationElement())
        End If
    Catch exc As InvalidOperationException
        ' TablePattern not supported.
        ' TO DO: error processing.
    End Try

    Return Nothing

End Function 'GetPrimaryHeaders

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

See also