How to save the property of the user-defined column ?
-
public class TXDataGridViewNumericColumn : DataGridViewColumn { public TXDataGridViewNumericColumn() : base(new TXNumericCell()) { this.InputType = NumericType.Integer; } public override DataGridViewCell CellTemplate { get { return base.CellTemplate; } set { if (value != null && !value.GetType().IsAssignableFrom(typeof(TXNumericCell))) { throw new InvalidCastException("Must be a CalendarCell"); } base.CellTemplate = value; } } private NumericType m_NumericType; public enum NumericType { Decimal, Integer, PositiveDecimal, NegativeDecimal, PositiveInteger, NegativeInteger } public NumericType InputType { get { return m_NumericType; } set { m_NumericType = value; } } public ICollection testCollection { get { return Icollection; } set { Icollection = value; } } private ICollection Icollection; public override object Clone() { DataGridViewColumn col = (DataGridViewColumn)base.Clone(); col.CellTemplate = new TXNumericCell(); return col; } } I define a column by inheritting the DataGridViewColumn, and add a property for this column, but in the design-mode when I change the value of this property , the value can not be saved, the codes as above. how to solve this issue? Thanks in advance!
-
public class TXDataGridViewNumericColumn : DataGridViewColumn { public TXDataGridViewNumericColumn() : base(new TXNumericCell()) { this.InputType = NumericType.Integer; } public override DataGridViewCell CellTemplate { get { return base.CellTemplate; } set { if (value != null && !value.GetType().IsAssignableFrom(typeof(TXNumericCell))) { throw new InvalidCastException("Must be a CalendarCell"); } base.CellTemplate = value; } } private NumericType m_NumericType; public enum NumericType { Decimal, Integer, PositiveDecimal, NegativeDecimal, PositiveInteger, NegativeInteger } public NumericType InputType { get { return m_NumericType; } set { m_NumericType = value; } } public ICollection testCollection { get { return Icollection; } set { Icollection = value; } } private ICollection Icollection; public override object Clone() { DataGridViewColumn col = (DataGridViewColumn)base.Clone(); col.CellTemplate = new TXNumericCell(); return col; } } I define a column by inheritting the DataGridViewColumn, and add a property for this column, but in the design-mode when I change the value of this property , the value can not be saved, the codes as above. how to solve this issue? Thanks in advance!
you have already posted this question!!!!! posting questions again does not mean you will get the answer quickly and also try to search answers your self and id dont find it then post the question