Show / Hide Table of Contents

Class ToggleSwitch

Represents a button that can be toggled on/off within a group of other buttons.

Inheritance
object
ControlBase
ButtonBase
ToggleButtonBase
ToggleSwitch
Inherited Members
ToggleButtonBase.OnIsSelected()
ToggleButtonBase.IsSelected
ToggleButtonBase.IsSelectedChanged
ButtonBase._textAlignment
ButtonBase.InvokeClick(bool)
ButtonBase.ProcessKeyboard(Keyboard)
ButtonBase.OnMouseIn(ControlBase.ControlMouseState)
ButtonBase.OnLeftMouseClicked(ControlBase.ControlMouseState)
ButtonBase.OnMouseExit(ControlBase.ControlMouseState)
ButtonBase.Text
ButtonBase.AutoSize
ButtonBase.TextAlignment
ButtonBase.Click
ControlBase.MouseState_IsMouseOver
ControlBase.MouseState_EnteredWithButtonDown
ControlBase.MouseState_IsMouseLeftDown
ControlBase.MouseState_IsMouseRightDown
ControlBase.OnUnfocused()
ControlBase.OnFocused()
ControlBase.OnIsDirtyChanged()
ControlBase.ProcessMouse(MouseScreenObjectState)
ControlBase.LostMouse(MouseScreenObjectState)
ControlBase.OnParentChanged()
ControlBase.OnPositionChanged()
ControlBase.PlaceRelativeTo(ControlBase, Direction.Types, int)
ControlBase.DetermineState()
ControlBase.OnStateChanged(ControlStates, ControlStates)
ControlBase.OnSurfaceChanged(ICellSurface, ICellSurface)
ControlBase.FindThemeFont()
ControlBase.FindThemeColors()
ControlBase.SetThemeColors(Colors)
ControlBase.HasThemeColors()
ControlBase.Resize(int, int)
ControlBase.OnResized()
ControlBase.CreateControlSurface()
ControlBase.OnMouseEnter(ControlBase.ControlMouseState)
ControlBase.OnRightMouseClicked(ControlBase.ControlMouseState)
ControlBase.ThemeState
ControlBase.UseKeyboard
ControlBase.UseMouse
ControlBase.CanFocus
ControlBase.CanResize
ControlBase.AlternateFont
ControlBase.Surface
ControlBase.MouseArea
ControlBase.IsMouseButtonStateClean
ControlBase.Position
ControlBase.AbsolutePosition
ControlBase.IsVisible
ControlBase.Tag
ControlBase.TabStop
ControlBase.TabIndex
ControlBase.IsDirty
ControlBase.Name
ControlBase.FocusOnMouseClick
ControlBase.Width
ControlBase.Height
ControlBase.IsFocused
ControlBase.IsEnabled
ControlBase.Bounds
ControlBase.Parent
ControlBase.State
ControlBase.IsDirtyChanged
ControlBase.Focused
ControlBase.Unfocused
ControlBase.PositionChanged
ControlBase.MouseEnter
ControlBase.MouseExit
ControlBase.MouseMove
ControlBase.MouseButtonClicked
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.UI.Controls
Assembly: SadConsole.dll
Syntax
[DataContract]
public class ToggleSwitch : ToggleButtonBase

Constructors

ToggleSwitch(int, int)

Creates a new checkbox control with the specified width and height.

Declaration
public ToggleSwitch(int width, int height)
Parameters
Type Name Description
int width

The width of the control.

int height

The height of the control.

Properties

BackgroundGlyph

The background glyph of the switch.

Declaration
[DataMember]
public int BackgroundGlyph { get; set; }
Property Value
Type Description
int

OffGlyphColor

The color of the OnGlyph when the control is IsSelected is false.

Declaration
[DataMember]
public Color OffGlyphColor { get; set; }
Property Value
Type Description
Color

OnGlyph

The on glyph of the switch.

Declaration
[DataMember]
public int OnGlyph { get; set; }
Property Value
Type Description
int

OnGlyphColor

The color of the OnGlyph when the control is IsSelected is true.

Declaration
[DataMember]
public Color OnGlyphColor { get; set; }
Property Value
Type Description
Color

SwitchOrientation

The orientation of the toggle switch relative to the text.

Declaration
public HorizontalAlignment SwitchOrientation { get; set; }
Property Value
Type Description
HorizontalAlignment
Remarks

Valid values are Left and Right.

SwitchThemeState

The theme state used for the switch.

Declaration
public ThemeStates SwitchThemeState { get; protected set; }
Property Value
Type Description
ThemeStates

Methods

OnClick()

Perfroms a click on the base button and also toggles the IsSelected property.

Declaration
protected override void OnClick()
Overrides
ButtonBase.OnClick()

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.

Declaration
protected override void RefreshThemeStateColors(Colors colors)
Parameters
Type Name Description
Colors colors

The colors to apply to the theme state.

Overrides
ControlBase.RefreshThemeStateColors(Colors)

UpdateAndRedraw(TimeSpan)

Redraws the control if applicable.

Declaration
public override void UpdateAndRedraw(TimeSpan time)
Parameters
Type Name Description
TimeSpan time

The duration of thecurrent frame.

Overrides
ControlBase.UpdateAndRedraw(TimeSpan)

Extension Methods

ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX