GridPattern.ColumnCountProperty Field
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Identifies the ColumnCount property.
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
Field Value
Examples
In the following example, a root element is passed to a function that returns a collection of UI Automation elements that are descendants of the root and satisfy a set of property conditions.
///--------------------------------------------------------------------
/// <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
Remarks
This identifier is used by UI Automation client applications. UI Automation providers should use the equivalent field in GridPatternIdentifiers.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應