Back to Devexpress

RepositoryItemToggleSwitch.ValueOn Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemtoggleswitch-1903d200.md

latest3.1 KB
Original Source

RepositoryItemToggleSwitch.ValueOn Property

Gets or sets the custom ToggleSwitch edit value associated with the “checked” editor state.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(true)]
[DXCategory("Behavior")]
public object ValueOn { get; set; }
vb
<DXCategory("Behavior")>
<DefaultValue(True)>
Public Property ValueOn As Object

Property Value

TypeDefaultDescription
Objecttrue

An Object that is the custom ToggleSwitch edit value associated with the “checked” editor state.

|

Remarks

By default, toggling a ToggleSwitch editor on or off switches the value of its EditValue property between true and false respectively. If you need to assign custom values for these states, utilize the RepositoryItemToggleSwitch.ValueOn and RepositoryItemToggleSwitch.ValueOff properties.

To retrieve a value associated with a specific editor state, call the RepositoryItemToggleSwitch.GetValueByState method. Vice versa, to get an editor state associated with a specific value, call the RepositoryItemToggleSwitch.GetStateByValue method.

csharp
toggleSwitch1.Properties.ValueOff = "Disabled";
toggleSwitch1.Properties.ValueOn = "Enabled";
var a = toggleSwitch1.Properties.GetValueByState(false); // returns "Disabled"
var b = toggleSwitch1.Properties.GetStateByValue("Enabled"); // returns true
var c = toggleSwitch1.Properties.GetStateByValue("Activated"); // returns false
vb
toggleSwitch1.Properties.ValueOff = "Disabled"
toggleSwitch1.Properties.ValueOn = "Enabled"
Dim a = toggleSwitch1.Properties.GetValueByState(False) ' returns "Disabled"
Dim b = toggleSwitch1.Properties.GetStateByValue("Enabled") ' returns true
Dim c = toggleSwitch1.Properties.GetStateByValue("Activated") ' returns false

See Also

RepositoryItemToggleSwitch Class

RepositoryItemToggleSwitch Members

DevExpress.XtraEditors.Repository Namespace