GridPattern.RowCountProperty 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
識別 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
欄位值
範例
在下列範例中,根項目會傳遞至函式,此函式會傳回屬於根子系的自動化專案集合,並滿足一組屬性條件。 本範例會擷取支援 GridPattern 但目前樹狀結構中只有一個專案的消費者介面自動化專案。
///--------------------------------------------------------------------
/// <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
備註
消費者介面自動化用戶端應用程式會使用此識別碼。 消費者介面自動化提供者應該使用 中的 GridPatternIdentifiers 對等欄位。