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 (。