Vixen
dd8b0a81
csharp
public sealed class Switch

A switch: a track, and a knob that slides along it.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ Not a checkbox with a different skin, and the difference is what it means rather than how it looks. A checkbox is a value in a form that is applied when the form is; a switch takes effect the moment it is flipped. A control set that makes them interchangeable produces dialogs with a switch beside an OK button, where nobody can tell whether Cancel undoes it.

⚠ Which is also why it does not validate, and the absence is the answer rather than the next thing to add. CheckBox and RadioGroup have a Required and a verdict; a switch deliberately has neither, because "this must be on before the form is acceptable" is a sentence about a form being submitted and a switch is not submitted — it has already happened. A required switch is a setting the application refuses to let the user turn off, which is a disabled switch or a confirmation, not a validity. So a <Switch> carries neither :valid nor :invalid, which is Selectors 4 § 10.6's own answer for an element that does not take part in constraint validation — see FieldValidity for why that is two bits and not one.

Fields and properties (4)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override AccessibleRole NativeRole
  • public UiElement Track

    The track the knob slides along.

  • public UiElement Knob

    The knob.

Methods (1)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

Used by (8)

  • GalleryHelloUi
  • AccessibilityTreeTestsVixen.Ui.Controls.Tests
  • ButtonTestsVixen.Ui.Controls.Tests
  • ControlVisualTestsVixen.Ui.Controls.Tests
  • ElementStateBitTestsVixen.Ui.Controls.Tests
  • KeyValueListTestsVixen.Ui.Controls.Tests
  • ToggleInteractionTestsVixen.Ui.Controls.Tests
  • MarkupBindingVixen.Editor.Inspector