GridPattern.RowCountProperty 字段

定义

标识 RowCount 属性。

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

字段值

AutomationProperty

示例

在以下示例中,将根元素传递给一个函数,该函数返回作为根子代的自动化元素集合,并满足一组属性条件。 此示例检索支持GridPattern但当前树中只有一个项的UI 自动化元素。

///--------------------------------------------------------------------
/// <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

注解

此标识符由UI 自动化客户端应用程序使用。 UI 自动化提供程序应使用等效字段。GridPatternIdentifiers

适用于