winforms - C# adding collection of custom properties from the property grid at design time -
i have issue of not being able add created columns collection of type.
i have following property:
public observablecollection<browselayoutcolumns> _browselayoutcolumns = new observablecollection<browselayoutcolumns>(); [category("design")] public observablecollection<browselayoutcolumns> browselayoutcolumns { { return _browselayoutcolumns; } set { _browselayoutcolumns = value; } }
browselayoutcolumns
[typeconverter(typeof(browselayoutcolumns))] public class browselayoutcolumns : datagridviewcolumn { #region properties public string columnname { get; set; } public string bindingfield { get; set; } #endregion public browselayoutcolumns() : base(new datagridviewtextboxcell()) { } public override object clone() { var copy = base.clone() browselayoutcolumns; copy.columnname = columnname; copy.bindingfield = bindingfield; return copy; } }
so on design time:
after press ok button.
this happens , wanted happen
the problem compiler :
private void initializecomponent() { this.browselayoutcolumns1 = new mybaseframework.mytypeeditors.browselayoutcolumns(); this.suspendlayout(); // // browselayoutcolumns1 // this.browselayoutcolumns1.bindingfield = "test"; this.browselayoutcolumns1.columnname = "test"; this.browselayoutcolumns1.name = "browselayoutcolumns1"; // // browsecontacts_base // this.clientsize = new system.drawing.size(606, 447); this.name = "browsecontacts_base"; this.resumelayout(false); }
why not following too?
browselayoutcolumns.add(browselayoutcolumns1);
what missing? beneficial! in advance
wiki
Comments
Post a Comment