OrCondition.OrCondition Constructor

Initializes a new instance of the OrCondition class.

Namespace: System.Windows.Automation
Assembly: UIAutomationClient (in uiautomationclient.dll)

public OrCondition (
	params Condition[] conditions
public OrCondition (
	Condition[] conditions
public function OrCondition (
	... conditions : Condition[]
Not applicable.



Two or more conditions, any one of which may be true for a match.

In the following example, an OrCondition is used to retrieve UI Automation elements that are either buttons or radio buttons.

/// <summary>
/// Uses OrCondition to retrieve elements that match either of two conditions.
/// </summary>
/// <param name="elementMainWindow">An application window element.</param>
public void OrConditionExample(AutomationElement elementMainWindow)
    if (elementMainWindow == null)
        throw new ArgumentException();

    OrCondition conditionButtons = new OrCondition(
        new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button),
        new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.RadioButton));
    AutomationElementCollection elementCollectionButtons = elementMainWindow.FindAll(
        TreeScope.Subtree, conditionButtons);
    Console.WriteLine("\nButtons and radio buttons:");
    foreach (AutomationElement autoElement in elementCollectionButtons)

    // Example of getting the conditions from the OrCondition.
    Condition[] conditions = conditionButtons.GetConditions();
    Console.WriteLine("OrCondition has " + conditions.GetLength(0) + " subconditions.");

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0