You override the DataGridExColumnStylesCollectionEditor class
public class DataGridExColumnStylesCollectionEditor : System.ComponentModel.Design.CollectionEditor
{
public DataGridExColumnStylesCollectionEditor(Type type) : base(type)
{ }
protected override System.Type[] CreateNewItemTypes()
{
return new Type[] {
typeof(DataGridTextBoxColumn),
typeof(DataGridDigitsTextBoxColumn)
//.......
};
}
}
//override the DataGridExTableStylesCollectionEditor class
public class DataGridExTableStylesCollectionEditor : System.ComponentModel.Design.CollectionEditor
{
public DataGridExTableStylesCollectionEditor(Type type) : base(type)
{
}
protected override System.Type[] CreateNewItemTypes()
{
return new Type[] {typeof(DataGridExTableStyle)};
}
}
//override the DataGridExTableStyle class
public class DataGridExTableStyle : System.Windows.Forms.DataGridTableStyle
{
[Editor(typeof(DataGridExColumnStylesCollectionEditor), typeof(UITypeEditor))]
public new GridColumnStylesCollection GridColumnStyles
{
get {return base.GridColumnStyles;}
}
protected override DataGridColumnStyle CreateGridColumn(PropertyDescriptor prop, bool isDefault)
{
return base.CreateGridColumn(prop, isDefault);
}
}
public class DataGridComboBoxColumn : DataGridTextBoxColumn
{
private ComboBox ColumnComboBox = null;
// Implement this class
}
//And
public class DataGridEx : System.Windows.Forms.DataGrid
{
[Editor(typeof(DataGridExTableStylesCollectionEditor), typeof(UITypeEditor))]
public new GridTableStylesCollection TableStyles
{
get {return base.TableStyles;}
}
}
YOU HAVE A DATA GRID ADD COMBOBOX IN DESIGN TIME