I have this problem, I created my own datagridviewcolumn and I wish add some properties that you can change in designtime editing…
here is my code:
private int nMaxLength;
[Description("Fondoscala valore"), Category("Sea")]
public int MaxLength
{
get { return nMaxLength; }
set { nMaxLength = value; }
}
and in fact is ok, when you open the column editor, you see this property under the Sea category and you can change, but when you changed it, if you go to the .Designer.cs file, you see the MaxLength value to 0.. no change…
what’s the problem??
thanks in advance
The Forms Designer does some internal trickery in order to allow you to change the column type (e.g. from
DataGridViewTextBoxColumntoDataGridViewButtonColumn) at design time. As a result of this, the designer relies on your subclass ofDataGridViewColumnhaving a correctly-implementedClone()method, i.e:If you do not override the
Clone()method, the designer will not commit any changes you make to custom property values.