将组合框的内容分组并添加标题 - c#

时间:2015-05-06 13:11:10

标签: c# combobox

我已将我的组合框链接到列表但我希望组合框具有用户无法点击的间隙和标题。我用来填充组合框的过程自动获取列表的内容。我没有使用你只需手动输入组合框内容的方法。这是我的代码:

class Appliances
    {
        public String name { get; set; }
        public double energy_rating { get; set;}
        public Appliances(String nameInput, double energy_ratingInput)
        {
            name = nameInput;
            energy_rating = energy_ratingInput;
        }
    }

List<Appliances> appliancesList = new List<Appliances>      
        {
            new Appliances("Freezer",0.15),
            new Appliances("Fridge",0.08),
            new Appliances("Fridge-freezer",0.3),
            new Appliances("Grill/hob",1.5),
            new Appliances("Kettle",2.6),
            new Appliances("Microwave",1),
            new Appliances("Oven",2.1),
            new Appliances("Toaster",1.1),
            new Appliances("Dishwasher",1.3),
        };

1 个答案:

答案 0 :(得分:0)

我认为ComboBox不支持组和分隔符。您可以查看http://www.brad-smith.info/blog/archives/104