How do you disable an item in listview control in .net 3.5

You can use the ListBoxItem.ForeColor and UseItemStyleForSubItems properties to make the item look dimmed. Use SystemColors.GrayText to pick the theme color for disabled items. Avoid disabling selection, it prevents the user from using the keyboard. Only disable the checkbox checking. For example:

    private void listView1_ItemCheck(object sender, ItemCheckEventArgs e) {
        // Disable checking odd-numbered items
        if (e.Index % 2 == 1) e.NewValue = e.CurrentValue;
    }

Leave a Comment