Partager via


TableItemPattern.ColumnHeaderItemsProperty Champ

Définition

Identifie la propriété qui récupère tous les en-têtes de colonnes associés à un élément ou une cellule de tableau.

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

Valeur de champ

Exemples

Dans l’exemple suivant, un tableau d’objets d’élément Automation représentant les éléments d’en-tête de ligne ou de colonne principaux d’une table est récupéré.

Pour les besoins de cet exemple, une relation entre la propriété et les RowOrColumnMajor éléments d’en-tête de ligne et de colonne est illustrée. Toutefois, une table peut avoir des en-têtes de ligne et de colonne quelle que soit la RowOrColumnMajor propriété de la 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;
}
    '''--------------------------------------------------------------------
    ''' <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 Function GetPrimaryHeaders( _
    ByVal targetControl As AutomationElement, _
    ByVal roworcolumnMajor As RowOrColumnMajor) As [Object]
        If targetControl Is Nothing Then
            Throw New ArgumentException("Target element cannot be null.")
        End If

        Try
            If roworcolumnMajor = roworcolumnMajor.RowMajor Then
                Return targetControl.GetCurrentPropertyValue( _
                TableItemPattern.RowHeaderItemsProperty)
            End If

            If roworcolumnMajor = roworcolumnMajor.ColumnMajor Then
                Return targetControl.GetCurrentPropertyValue( _
                TableItemPattern.ColumnHeaderItemsProperty)
            End If
        Catch
        End Try
        ' TableItemPattern not supported.
        ' TO DO: error processing.

        Return Nothing

    End Function 'GetPrimaryHeaders
End Class

Remarques

Cet identificateur est utilisé par UI Automation applications clientes. UI Automation fournisseurs doivent utiliser le champ équivalent dans TableItemPatternIdentifiers.

Cette propriété n’est pas présente dans et doit être récupérée à TableItemPattern.TableItemPatternInformation l’aide de GetCurrentPropertyValue ou GetCachedPropertyValue.

S’applique à

Voir aussi