I\'ve created a custom column for DataGridView, and the reason is that I want to add a property (type) to a column. I right click the DataGridView and select "Edit columns.
I think you need to override the Clone()
method in order for that to work:
public class CustomColumn : DataGridViewColumn {
public CustomColumn()
: base(new DataGridViewTextBoxCell()) {
}
[DisplayName("Type")]
[Category("Custom Property")]
public String type { get; set; }
public override object Clone() {
CustomColumn copy = base.Clone() as CustomColumn;
copy.type = type;
return copy;
}
}
See Custom properties on overridden DataViewColumn do not save