I create a custom User Control which inherits from DataGridViewColumn.
Moreover, I added some properties in the control, but I can't modify them in design-time.
Even I set the default value as true, it's still false.
code:
public class ParaGridViewColumn : DataGridViewColumn
{
private bool _Necessary;
private bool _ReadOnlyEmpty;
[Description("Default cell status."), Category("Behavior"), DefaultValue(false)]
public bool Necessary { get { return _Necessary; } set { _Necessary = value;} }
[Description("When ReadOnly is true, clear value on the cell or not."), Category("Behavior"), DefaultValue(true)]
public bool ReadOnlyEmpty { get { return _ReadOnlyEmpty; } set { _ReadOnlyEmpty = value; }}
public ParaGridViewColumn()
{
this.CellTemplate = new ParaGridViewCell();
}
}
The new properties can shown on the window, but their default value are false.
I change them to true, entering and opening this window again, it's still false.
However, I can modify other properties regularly. It means I didn't lock this control.
Why is that? Did I make something wrong?
Thanks a lot.