IToggleProvider.ToggleState 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得控制項的切換狀態。
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
屬性值
控制項的 ToggleState。
範例
下列範例顯示可切換之控制項的這個方法實作。 傳回的 ToggleState 是以控制項的色彩為基礎;這類似于 IsChecked 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
備註
如果支援 Indeterminate) ,控制項必須依下列順序迴圈 ToggleState 執行: On 、 Off 和 (。