Ran into this issue when designing a Ribbon (Visual Designer) control that contained a ComboBox. After you add items to the ComboBox using the properties window, everything appears fine until you attempt to Save or Build. You will get the following error:

Code generation for property ‘Items’ failed. Error was: ‘Object reference not set to an instance of an object’This is actually a bug in Visual Studio 2010 RTM and the only workaround is to manually add the ComboBox items through code:

var item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
item.Label = "Item A";
this.ComboBox1.Items.Add(item);

2 Comments