Posted 18 May 2022, 3:43 pm EST
Hi.
Suppose I have grid which is bound to some BS, based on this BS I customized visualization of grid (say 3 columns instead of 7), all my grid settigns stored in resx file. Then in runtime I bind IEnumerable to datasource property of my bindingsource (which is binded as ds for grid). Data displayed, everything is fine but my grid settings ignored (all,7, columns shown instead of 3, all editable instead of false). I mean, all my visualization settings for grid completely ignored…
Here is code:
this.BindingSource.AllowNew = false;
this.BindingSource.DataSource = typeof(MyObj);
....
this.c1FlexGrid1.AutoResize = true;
this.c1FlexGrid1.ColumnInfo = resources.GetString("c1FlexGrid1.ColumnInfo");
this.c1FlexGrid1.DataSource = this.BindingSource;
this.c1FlexGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.c1FlexGrid1.Location = new System.Drawing.Point(0, 0);
this.c1FlexGrid1.Name = "c1FlexGrid1";
this.c1FlexGrid1.Rows.Count = 1;
this.c1FlexGrid1.Size = new System.Drawing.Size(656, 542);
this.c1FlexGrid1.StyleInfo = resources.GetString("c1FlexGrid1.StyleInfo");
this.c1FlexGrid1.TabIndex = 0;
this.c1FlexGrid1.VisualStyle = C1.Win.C1FlexGrid.VisualStyle.Office2010Blue;
and how I bind data:
BindingSource.DataSource = rep.GetData(someId);//IEnumerable BindingSource.ResetBindings(false);
c1FlexGrid1.Refresh();
Data is shown but all settings from (resources.GetString(“c1FlexGrid1.ColumnInfo”) ignored.
I’ve tried to use List instead IEnumerable, C1DataCollectionBindingList but same result.
What I’m doing wrong?
Thanks in advance.