CheckedListBoxItemCollection.Item[Object] Property
Returns an item that has the specified value.
Namespace: DevExpress.XtraEditors.Controls
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Parameters
Name | Type | Description |
---|---|---|
value | Object | An object that represent’s the value of the item to be retrieved. |
Property Value
Type | Description |
---|---|
CheckedListBoxItem | A CheckedListBoxItem object whose value matches the specified object. |
Remarks
If an editor is displaying Boolean options, each item is typically associated with a string value. So the value parameter must be a string.
If an editor is displaying a bit field (set of flags), each item’s value is a corresponding flag, and so the value parameter must specify this flag.
Example
The code below populates the RepositoryItemCheckedComboBoxEdit.Items collection with five items, each item stores a string value.
The CheckedComboBoxEdit.SetEditValue method is called to select “Circle” and “Ellipse” items. The “Circle” item is then disabled so that users cannot de-select it.
Note that the code modifies the RepositoryItemCheckedComboBoxEdit.SeparatorChar property to change the edit value separator char from the default comma (“,”) to a semicolon (“;”). The same separator char must be used in the SetEditValue method parameter.
// Add check items to the control's dropdown.
string[] itemValues = new string[] {
"Circle", "Rectangle", "Ellipse",
"Triangle", "Square" };
foreach (string value in itemValues)
checkedComboBoxEdit1.Properties.Items.Add(value, CheckState.Unchecked, true);
// Specify the separator character.
checkedComboBoxEdit1.Properties.SeparatorChar = ';';
// Set the edit value.
checkedComboBoxEdit1.SetEditValue("Circle; Ellipse");
// Disable the Circle item.
checkedComboBoxEdit1.Properties.Items["Circle"].Enabled = false;