Skip to main content
A newer version of this page is available. .

ToggleSwitch Class

The check editor to edit Boolean values using a movable bar.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v18.1.dll

Declaration

[SmartTagFilter(typeof(ToggleSwitchFilter))]
[SmartTagAction(typeof(ToggleSwitchActions), "On", "Switch On", SmartTagActionType.RefreshContentAfterExecute)]
[SmartTagAction(typeof(ToggleSwitchActions), "Off", "Switch Off", SmartTagActionType.RefreshContentAfterExecute)]
[ToolboxTabName("DX.18.1: Common Controls")]
[ToolboxBitmap(typeof(ToolboxIconsRootNS), "ToggleSwitch")]
[DefaultBindingPropertyEx("IsOn")]
public class ToggleSwitch :
    BaseCheckEdit

Remarks

The ToggleSwitch is a Windows UI-style check editor that allows an end-user to switch between two states (On and Off).

ToggleSwitch.png

The editor’s state is specified by the ToggleSwitch.IsOn property. The ToggleSwitch.Toggle method inverts the current state.

The text displayed by the editor in the checked and unchecked states is specified by the RepositoryItemToggleSwitch.OnText and RepositoryItemToggleSwitch.OffText properties, available via the ToggleSwitch.Properties object. To hide the text, use the RepositoryItemToggleSwitch.ShowText property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ToggleSwitch class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also