IToggleProvider.ToggleState Właściwość

Definicja

Pobiera stan przełącznika kontrolki.

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

Wartość właściwości

ToggleState

Kontrolka ToggleState .

Przykłady

W poniższym przykładzie przedstawiono implementację tej metody dla kontrolki, która może zostać przełączona. Zwrócony element ToggleState jest oparty na kolorze kontrolki; jest to podobne do IsChecked właściwości kontrolki 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

Uwagi

Kontrolka musi przechodzić przez następującą ToggleState kolejność: On, Offi (jeśli jest obsługiwana) Indeterminate.

Dotyczy

Zobacz też