ComboBox ی با آیتم های غیر قابل انتخاب

یک کمبوباکس بر روی فرم قرار دهید و کدهای زیر را در رویداد Load آن بنویسید :

using System;
using System.Windows.Forms;

namespace Combobox
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private class ComboBoxItem
        {
            public int Value { get; set; }
            public string Text { get; set; }
            public bool Selectable { get; set; }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.comboBox1.ValueMember = "Value";
            this.comboBox1.DisplayMember = "Text";
            this.comboBox1.Items.AddRange(new[] {
            new ComboBoxItem() { Selectable = false, Text="استان خوزستان", Value=0},
            new ComboBoxItem() { Selectable = true, Text="دزفول", Value=1},
            new ComboBoxItem() { Selectable = true, Text="آبادان", Value=2},
            new ComboBoxItem() { Selectable = false, Text="استان تهران", Value=3},
            new ComboBoxItem() { Selectable = true, Text="ورامین", Value=4},
            new ComboBoxItem() { Selectable = true, Text="کرج", Value=5},
        });

            this.comboBox1.SelectedIndexChanged += (cbSender, cbe) =>
            {
                var cb = cbSender as ComboBox;

                if (cb.SelectedItem != null && cb.SelectedItem is ComboBoxItem && ((ComboBoxItem)cb.SelectedItem).Selectable == false)
                {
                    // deselect item
                    cb.SelectedIndex = -1;
                }
            };
        }
    }
}

حال برنامه را اجرا و بر روی استان خوزستان و استان تهران کلیک کنید.