Skip to main content

dxSwitch

Namespace: Wisej.Web.Ext.DevExtreme

Assembly: Wisej.Web.Ext.DevExtreme (4.1.0.0)

The Switch is a widget that can be in two states: "On" and "Off".

public class dxSwitch : dxBase

Constructors​

Instance member dxSwitch()​

Constructs a new instance of the dxSwitch class.

Example:

The following example creates a switch that is initially on and reacts when the user toggles it.

var notifications = new dxSwitch();
notifications.Options.value = true;
notifications.Instance.onValueChanged += new WidgetEventHandler((s, e) =>
{
bool enabled = e.Data.value;
AlertBox.Show(enabled ? "Notifications enabled" : "Notifications disabled");
});
notifications.Size = new Size(60, 30);
this.Controls.Add(notifications);

Instance member dxSwitch(options)​

Constructs a new instance of the dxSwitch class.

NameTypeDescription
optionsObjectInitial set of options.

Example:

The following example creates a switch with custom texts for the two states.

var autoSave = new dxSwitch(new
{
value = false,
switchedOnText = "AUTO",
switchedOffText = "MANUAL",
width = 90
});
autoSave.Size = new Size(90, 30);
this.Controls.Add(autoSave);

Implements​