Win8ToggleSwitch
A check box drawn as a sliding switch in the modern Windows style: a rectangular track with an outer and an inner border, a gradient-filled interior, and a solid stick that sits at the left or the right end according to the state.
public class Win8ToggleSwitch : Control
Inherits from / implements: Control
Remarks
Every part is drawn by this control rather than composed from child controls, and each part has an independent colour for the checked and unchecked states, so the switch can be themed to match a host application without subclassing. Painting goes through an off-screen buffer. The drawing is a sequence of overlapping rectangles, and painting those straight to the screen produces visible tearing while the pointer moves across the control.
Members at a glance
Win8ToggleSwitch | Initializes a new instance of the Win8ToggleSwitch class. |
BackgroundEndColor | Gets or sets the end color of the background. |
BackgroundEndColorUnchecked | Gets or sets the background end color for the unchecked state. |
BackgroundStartColor | Gets or sets the start color of the background. |
BackgroundStartColorUnchecked | Gets or sets the background start color for the unchecked state. |
InnerBorderColor | Gets or sets the color of the inner border. |
InnerBorderColorUnchecked | Gets or sets the inner border color for the unchecked state. |
InnerBorderThickness | Gets or sets the inner border thickness. |
IsChecked | Gets or sets a value indicating whether this instance is checked. |
OuterBorderColor | Gets or sets the color of the outer border. |
OuterBorderColorUnchecked | Gets or sets the outer border color for the unchecked state. |
OuterBorderThickness | Gets or sets the outer border thickness. |
ShouldDrawFocusRectangleWhenFocused | Gets or sets a value indicating whether the control should draw focus rectangle when focused. |
ShouldDrawGapBetweenSwitchStickAndTrack | Gets or sets a value indicating whether the control should draw gap between switch-stick and the track. |
SwitchStickControlGapWidth | Gets or sets the width of the switch-stick control gap. |
ToggleStickColor | Gets or sets the color of the toggle stick. |
ToggleStickColorUnchecked | Gets or sets the toggle stick color for its unchecked state. |
ToggleSwitchStickWidth | Gets or sets the width of the toggle switch-stick. |
Dispose | — |
OnGotFocus | — |
OnHandleCreated | — |
OnKeyDown | — |
OnKeyUp | — |
OnLostFocus | — |
OnMouseEnter | — |
OnMouseLeave | — |
OnMouseUp | — |
OnPaint | — |
OnParentChanged | — |
Toggled | Occurs when the switch has been toggled. |
Constructors
Win8ToggleSwitch
Initializes a new instance of the Win8ToggleSwitch class.
Properties
BackgroundEndColor
Gets or sets the end color of the background.
BackgroundEndColorUnchecked
Gets or sets the background end color for the unchecked state.
BackgroundStartColor
Gets or sets the start color of the background.
BackgroundStartColorUnchecked
Gets or sets the background start color for the unchecked state.
InnerBorderColor
Gets or sets the color of the inner border.
InnerBorderColorUnchecked
Gets or sets the inner border color for the unchecked state.
InnerBorderThickness
Gets or sets the inner border thickness.
IsChecked
Gets or sets a value indicating whether this instance is checked.
OuterBorderColor
Gets or sets the color of the outer border.
OuterBorderColorUnchecked
Gets or sets the outer border color for the unchecked state.
OuterBorderThickness
Gets or sets the outer border thickness.
ShouldDrawFocusRectangleWhenFocused
Gets or sets a value indicating whether the control should draw focus rectangle when focused.
ShouldDrawGapBetweenSwitchStickAndTrack
Gets or sets a value indicating whether the control should draw gap between switch-stick and the track.
SwitchStickControlGapWidth
Gets or sets the width of the switch-stick control gap.
ToggleStickColor
Gets or sets the color of the toggle stick.
ToggleStickColorUnchecked
Gets or sets the toggle stick color for its unchecked state.
ToggleSwitchStickWidth
Gets or sets the width of the toggle switch-stick.
Methods
Dispose
No summary in the source yet.
OnGotFocus
No summary in the source yet.
OnHandleCreated
No summary in the source yet.
OnKeyDown
No summary in the source yet.
OnKeyUp
No summary in the source yet.
OnLostFocus
No summary in the source yet.
OnMouseEnter
No summary in the source yet.
OnMouseLeave
No summary in the source yet.
OnMouseUp
No summary in the source yet.
OnPaint
No summary in the source yet.
OnParentChanged
No summary in the source yet.
Events
Toggled
Occurs when the switch has been toggled.