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".
- C#
- VB.NET
public class dxSwitch : dxBase
Public Class dxSwitch
Inherits dxBase
Constructors
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);
dxSwitch(options)
Constructs a new instance of the dxSwitch class.
| Name | Type | Description |
|---|---|---|
| options | Object | Initial 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);