Back to Devexpress

ListBoxItem.Value Property

windowsforms-devexpress-dot-xtraeditors-dot-controls-dot-listboxitem.md

latest5.2 KB
Original Source

ListBoxItem.Value Property

Gets or sets the item’s value.

Namespace : DevExpress.XtraEditors.Controls

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(null)]
[DXCategory("Data")]
public virtual object Value { get; set; }
vb
<DefaultValue(Nothing)>
<DXCategory("Data")>
Public Overridable Property Value As Object

Property Value

TypeDefaultDescription
Objectnull

An object representing the item’s value.

|

Remarks

By default, the item’s display text is specified by the ToString method called for the Value object. In a CheckedListBoxControl and ImageListBoxControl, a list item’s display text can be specified via the CheckedListBoxItem.Description and ImageListBoxItem.Description properties, respectively.

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

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.

xaf-how-to-display-an-enumeration-property-as-a-drop-down-box-with-check-boxes/CS/EFCore/EnumCheckBoxEF/EnumCheckBoxEF.Win/Editors/EnumPropertyEditorEx.cs#L47

csharp
foreach (CheckedListBoxItem itm in checkedItem.Items) {
    itm.Description = EnumDescriptor.GetCaption(itm.Value);
}

winforms-dashboard-custom-properties/CS/WinForms-Dashboard-Custom-Properties/Modules/GridFixedColumnModule.cs#L93

csharp
CheckedListBoxControl checkList = sender as CheckedListBoxControl;
CheckedComboBoxItem item = checkList.Items[e.Index].Value as CheckedComboBoxItem;
item.Checked = checkList.Items[e.Index].CheckState == CheckState.Checked;

winforms-grid-hide-vertical-lines-between-certain-columns/CS/E3647/Form1.cs#L82

csharp
foreach (CheckedListBoxItem item in checkedListBoxControl1.CheckedItems)
    columnList.Add(item.Value as GridColumn);
helper.Columns = columnList;

winforms-dashboard-custom-properties/VB/WinForms-Dashboard-Custom-Properties/Modules/GridFixedColumnModule.vb#L96

vb
Dim checkList As CheckedListBoxControl = TryCast(sender, CheckedListBoxControl)
Dim item As CheckedComboBoxItem = TryCast(checkList.Items(e.Index).Value, CheckedComboBoxItem)
item.Checked = checkList.Items(e.Index).CheckState = CheckState.Checked

winforms-grid-hide-vertical-lines-between-certain-columns/VB/E3647/Form1.vb#L79

vb
For Each item As CheckedListBoxItem In checkedListBoxControl1.CheckedItems
    columnList.Add(TryCast(item.Value, GridColumn))
Next item

See Also

GetItemValue(Int32)

SetItemValue(Object, Int32)

CheckedListBoxItem.Description

ImageListBoxItem.Description

ListBoxItem Class

ListBoxItem Members

DevExpress.XtraEditors.Controls Namespace