ToggleSwitch Class
Definition
Section titled “Definition”Represents a button that can be toggled on/off within a group of other buttons.
[DataContract]public class ToggleSwitch : ToggleButtonBaseInheritance object → ControlBase → ButtonBase → ToggleButtonBase
Constructors
Section titled “Constructors”ToggleSwitch(int, int)
Section titled “ToggleSwitch(int, int)”Creates a new checkbox control with the specified width and height.
public ToggleSwitch(int width, int height)Parameters
Section titled “Parameters”width int
The width of the control.
height int
The height of the control.
Properties
Section titled “Properties”OnGlyph
Section titled “OnGlyph”The on glyph of the switch.
[DataMember]public int OnGlyph { get; set; }BackgroundGlyph
Section titled “BackgroundGlyph”The background glyph of the switch.
[DataMember]public int BackgroundGlyph { get; set; }OnGlyphColor
Section titled “OnGlyphColor”The color of the OnGlyph when the control is IsSelected is true.
[DataMember]public Color OnGlyphColor { get; set; }OffGlyphColor
Section titled “OffGlyphColor”The color of the OnGlyph when the control is IsSelected is false.
[DataMember]public Color OffGlyphColor { get; set; }SwitchThemeState
Section titled “SwitchThemeState”The theme state used for the switch.
public ThemeStates SwitchThemeState { get; protected set; }SwitchOrientation
Section titled “SwitchOrientation”The orientation of the toggle switch relative to the text.
public HorizontalAlignment SwitchOrientation { get; set; }Remarks
Section titled “Remarks”Valid values are Left and Right.
Methods
Section titled “Methods”OnClick()
Section titled “OnClick()”Perfroms a click on the base button and also toggles the IsSelected property.
protected override void OnClick()RefreshThemeStateColors(Colors)
Section titled “RefreshThemeStateColors(Colors)”Updates the ThemeState by calling RefreshTheme(Colors) with the provided colors. Override this method to adjust how colors are used by the ThemeState.
protected override void RefreshThemeStateColors(Colors colors)Parameters
Section titled “Parameters”colors Colors
The colors to apply to the theme state.
UpdateAndRedraw(TimeSpan)
Section titled “UpdateAndRedraw(TimeSpan)”Redraws the control if applicable.
public override void UpdateAndRedraw(TimeSpan time)Parameters
Section titled “Parameters”time TimeSpan
The duration of thecurrent frame.