Lire en anglais

Partager via


PropertyConditionFlags Énumération

Définition

Contient des valeurs qui spécifient la façon dont une valeur de propriété est testée dans un PropertyCondition.

Cette énumération prend en charge une combinaison au niveau du bit de ses valeurs membres.

C#
[System.Flags]
public enum PropertyConditionFlags
Héritage
PropertyConditionFlags
Attributs

Champs

Nom Valeur Description
IgnoreCase 1

Spécifie que la comparaison avec une valeur de propriété de type chaîne ne respecte pas la casse.

None 0

Spécifie que la valeur de propriété est testée à l'aide du comportement par défaut (comparaison de chaînes en respectant la casse).

Exemples

Dans l’exemple suivant, IgnoreCase est défini dans un System.Windows.Automation.PropertyCondition.

C#
/// <summary>
/// Find a UI Automation child element by ID.
/// </summary>
/// <param name="controlName">Name of the control, such as "button1"</param>
/// <param name="parentElement">Parent element, such as an application window, or the 
/// AutomationElement.RootElement when searching for the application window.</param>
/// <returns>The UI Automation element.</returns>
private AutomationElement FindChildElement(String controlName, AutomationElement rootElement)
{
    if ((controlName == "") || (rootElement == null))
    {
        throw new ArgumentException("Argument cannot be null or empty.");
    }
    // Set a property condition that will be used to find the main form of the
    // target application. In the case of a WinForms control, the name of the control
    // is also the AutomationId of the element representing the control.
    Condition propCondition = new PropertyCondition(
        AutomationElement.AutomationIdProperty, controlName, PropertyConditionFlags.IgnoreCase);

    // Find the element.
    return rootElement.FindFirst(TreeScope.Element | TreeScope.Children, propCondition);
}

S’applique à

Produit 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

Voir aussi