GridPattern.ColumnCountProperty Champ
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Identifie la propriété ColumnCount.
public: static initonly System::Windows::Automation::AutomationProperty ^ ColumnCountProperty;
public static readonly System.Windows.Automation.AutomationProperty ColumnCountProperty;
staticval mutable ColumnCountProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ColumnCountProperty As AutomationProperty
Valeur de champ
Exemples
Dans l’exemple suivant, un élément racine est passé à une fonction qui retourne une collection d’éléments UI Automation descendants de la racine et répondant à un ensemble de conditions de propriété.
///--------------------------------------------------------------------
/// <summary>
/// Finds all automation elements that satisfy
/// the specified condition(s).
/// </summary>
/// <param name="targetApp">
/// The automation element from which to start searching.
/// </param>
/// <returns>
/// A collection of automation elements satisfying
/// the specified condition(s).
/// </returns>
///--------------------------------------------------------------------
private AutomationElementCollection FindAutomationElement(
AutomationElement targetApp)
{
if (targetApp == null)
{
throw new ArgumentException("Root element cannot be null.");
}
PropertyCondition conditionSupportsGridPattern =
new PropertyCondition(
AutomationElement.IsGridPatternAvailableProperty, true);
PropertyCondition conditionOneColumn =
new PropertyCondition(
GridPattern.ColumnCountProperty, 1);
PropertyCondition conditionOneRow =
new PropertyCondition(
GridPattern.RowCountProperty, 1);
AndCondition conditionSingleItemGrid =
new AndCondition(
conditionSupportsGridPattern,
conditionOneColumn, conditionOneRow);
return targetApp.FindAll(
TreeScope.Descendants, conditionSingleItemGrid);
}
'''--------------------------------------------------------------------
''' <summary>
''' Finds all automation elements that satisfy
''' the specified condition(s).
''' </summary>
''' <param name="targetApp">
''' The automation element from which to start searching.
''' </param>
''' <returns>
''' A collection of automation elements satisfying
''' the specified condition(s).
''' </returns>
'''--------------------------------------------------------------------
Private Function FindAutomationElement( _
ByVal targetApp As AutomationElement) As AutomationElementCollection
If targetApp Is Nothing Then
Throw New ArgumentException("Root element cannot be null.")
End If
Dim conditionSupportsGridPattern As New PropertyCondition( _
AutomationElement.IsGridPatternAvailableProperty, True)
Dim conditionOneColumn As New PropertyCondition( _
GridPattern.ColumnCountProperty, 1)
Dim conditionOneRow As New PropertyCondition( _
GridPattern.RowCountProperty, 1)
Dim conditionSingleItemGrid As New AndCondition( _
conditionSupportsGridPattern, conditionOneColumn, conditionOneRow)
Return targetApp.FindAll( _
TreeScope.Descendants, conditionSingleItemGrid)
End Function 'FindAutomationElement
Remarques
Cet identificateur est utilisé par UI Automation applications clientes. UI Automation fournisseurs doivent utiliser le champ équivalent dans GridPatternIdentifiers.