ExpandCollapsePattern.ExpandCollapseStateProperty Field
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 ExpandCollapseState property.
public: static initonly System::Windows::Automation::AutomationProperty ^ ExpandCollapseStateProperty;
public static readonly System.Windows.Automation.AutomationProperty ExpandCollapseStateProperty;
staticval mutable ExpandCollapseStateProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ExpandCollapseStateProperty As AutomationProperty
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 conditionLeafNode =
new PropertyCondition(
ExpandCollapsePattern.ExpandCollapseStateProperty,
ExpandCollapseState.LeafNode);
return targetApp.FindAll(
TreeScope.Descendants, conditionLeafNode);
}
'''--------------------------------------------------------------------
''' <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 conditionLeafNode As New PropertyCondition( _
ExpandCollapsePattern.ExpandCollapseStateProperty, _
ExpandCollapseState.LeafNode)
Return targetApp.FindAll(TreeScope.Descendants, conditionLeafNode)
End Function 'FindAutomationElement
This identifier is used by UI Automation client applications. UI Automation providers should use the equivalent field in ExpandCollapsePatternIdentifiers.
ExpandCollapseState refers to the visibility of immediate child objects only; it does not refer to the visibility of all descendant objects.
The default value is Expanded.
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: