Share via


IToggleProvider.ToggleState Propriedade

Definição

Recupera o estado de alternância do controle.

public:
 property System::Windows::Automation::ToggleState ToggleState { System::Windows::Automation::ToggleState get(); };
public System.Windows.Automation.ToggleState ToggleState { get; }
member this.ToggleState : System.Windows.Automation.ToggleState
Public ReadOnly Property ToggleState As ToggleState

Valor da propriedade

ToggleState

O ToggleState do controle.

Exemplos

O exemplo a seguir mostra uma implementação desse método para um controle que pode ser alternado. O ToggleState retornado é baseado na cor do controle; isso é análogo à IsChecked propriedade de um controle CheckBox.

/// <summary>
/// Retrieves the toggle state of the control.
/// </summary>
/// <remarks>
/// For this custom control the toggle state is reflected by the color 
/// of the control. This is analogous to the CheckBox IsChecked property.
/// Green   - ToggleState.On
/// Red     - ToggleState.Off
/// Yellow  - ToggleState.Indeterminate
/// </remarks>
ToggleState IToggleProvider.ToggleState
{
    get
    {
        return customControl.toggleStateColor[customControl.controlColor]; ;
    }
}
''' <summary>
''' Retrieves the toggle state of the control.
''' </summary>
''' <remarks>
''' For this custom control the toggle state is reflected by the color 
''' of the control. This is analogous to the CheckBox IsChecked property.
''' Green   - ToggleState.On
''' Red     - ToggleState.Off
''' Yellow  - ToggleState.Indeterminate
''' </remarks>
Private ReadOnly Property IToggleProvider_ToggleState() As ToggleState Implements IToggleProvider.ToggleState
    Get
        Return customControl.toggleStateColor(customControl.controlColor)

    End Get
End Property

Comentários

Um controle deve percorrer seu ToggleState ciclo nesta ordem: On, Offe (se houver suporte) Indeterminate.

Aplica-se a

Confira também