TogglePattern.ToggleStateProperty Campo
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Identifica a ToggleState propriedade.
public: static initonly System::Windows::Automation::AutomationProperty ^ ToggleStateProperty;
public static readonly System.Windows.Automation.AutomationProperty ToggleStateProperty;
staticval mutable ToggleStateProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ToggleStateProperty As AutomationProperty
Valor de Campo
Exemplos
No exemplo seguinte, um elemento raiz é passado a uma função que devolve uma coleção de elementos de automação que são descendentes da raiz e satisfazem um conjunto de condições de propriedade.
///--------------------------------------------------------------------
/// <summary>
/// Finds all automation elements that satisfy
/// the specified condition(s).
/// </summary>
/// <param name="rootElement">
/// 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 rootElement)
{
if (rootElement == null)
{
throw new ArgumentException("Root element cannot be null.");
}
PropertyCondition conditionOn =
new PropertyCondition(
TogglePattern.ToggleStateProperty, ToggleState.On);
PropertyCondition conditionIndeterminate =
new PropertyCondition(
TogglePattern.ToggleStateProperty, ToggleState.Indeterminate);
// Use any combination of the preceding condtions to
// find the control(s) of interest
OrCondition condition = new OrCondition(
conditionOn,
conditionIndeterminate);
return rootElement.FindAll(TreeScope.Descendants, condition);
}
'''--------------------------------------------------------------------
''' <summary>
''' Finds all automation elements that satisfy
''' the specified condition(s).
''' </summary>
''' <param name="rootElement">
''' 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 rootElement As AutomationElement) As AutomationElementCollection
If rootElement Is Nothing Then
Throw New ArgumentException("Root element cannot be null.")
End If
Dim conditionOn As New PropertyCondition( _
TogglePattern.ToggleStateProperty, ToggleState.On)
Dim conditionIndeterminate As New PropertyCondition( _
TogglePattern.ToggleStateProperty, ToggleState.Indeterminate)
' Use any combination of the preceding condtions to
' find the control(s) of interest
Dim condition As OrCondition = _
New OrCondition(conditionOn, conditionIndeterminate)
Return rootElement.FindAll(TreeScope.Descendants, condition)
End Function 'FindAutomationElement
Observações
Este identificador é utilizado por aplicações clientes de Automatização da Interface de Utilizador. Automatização da Interface de Utilizador prestadores devem usar o campo equivalente em TogglePatternIdentifiers.
Um AutomationElement deve percorrer os seus ToggleState nesta ordem: On, Off e, se suportado, Indeterminate.