A newer version of this page is available. Switch to the current version.

BaseCheckedListBoxControl.GetItemEnabled Event

Enables you to disable specific items, in bound mode.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v19.2.dll


public event GetItemEnabledEventHandler GetItemEnabled

Event Data

The GetItemEnabled event's data class is DevExpress.XtraEditors.Controls.GetItemEnabledEventArgs.


In bound mode, a list box control is bound to a data source via the BaseListBoxControl.DataSource property. To disable specific items in this mode, handle the GetItemEnabled event.

To disable items in unbound mode, use the CheckedListBoxItem.Enabled property of the items.


The following example shows how to disable specific items in a checked list box control via the BaseCheckedListBoxControl.GetItemEnabled event.

Assume that a CheckedListBoxControl is bound to a BindingSource object containinig information on products. The data source contains a ProductName and Discontinued fields. The values of the ProductName field are displayed in the control. The values of the Discontinued field are used to decide whether a corresponding check item should be disabled.

The result is displayed below:


using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;

// Assign a data source to the checked list box.
checkedListBoxControl1.DataSource = productsBindingSource;
checkedListBoxControl1.DisplayMember = "ProductName";

// Disable the items that have the Discontinued field set to true
private void checkedListBoxControl1_GetItemEnabled(object sender, GetItemEnabledEventArgs e) {
    CheckedListBoxControl control = sender as CheckedListBoxControl;
    bool isDiscontinued = (bool)((control.DataSource as BindingSource)[e.Index] as 
    if (isDiscontinued)
        e.Enabled = false;
See Also