Hi,
in design mode I enlarge the width of certain columns. (it is bound to DataSet or IListSource)
In the InitializeComponent the designer writes:
UltraGridColumn ultraGridColumn2 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("NAME"
);
ultraGridColumn2.Width = 250;
When the grid is shown it only has the default size of each column. AutofitStyle is set to none.
The strange thing is if I manually add :
ultraGrid1.Displaylayout.Bands[0].Colomns["NAME"].Width = ultraColumn2.Width
after:
((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
The column has the desired size.
Is this a bug? What can I do to stop this behavior? Why is EndInit changing my colum width?
regards
Stefan
This article should help.
HOWTO:How can I define columns in the grid at Design-time and bind them at run-time so that some fields of the data are excluded from the grid?
Hi Mark,
I already posted this to the tech support and I can reproduce the problem in a simple project.
1. Create a Form Porject
2. Create a UserControl (userControl1) with a Panel (dock fill) and insert a Grid with a dataset as datasource. Resize some columns.
3. Create a another UserControl (userControl2) with a ultraPanel (dock fill) and insert a Grid with the same dataset as source. Resize some columns.
4. Add two buttons to the form.
5. Button Click button1 --> instanciate the userControl1 --> add userControl1 to Form --> form1.Controls.Add(userControl1) ---> The Grid has the resized columns.
6. Repeat step 5 with userControl2 --> the columns have their default size :-(
I will post as soon as I get a confirmation of why this is happening.
Hi Stefan,
There's really not enough information here to go on. For example, you are not saying how you are populating the data sources at run-time.
Are these two instances of the same UserControl or two completely different UserControl classes?
The best thing for you to do would be to create a small sample project and either Submit an incident to Infragistics Developer Support or post it here so we can check it out.
Hi Mike,
tech support case: CAS-22806-4DEIFF can reproduce the problem.
I just wanted to post it here so other people facing this problem know that there is an issue.
As far as I am aware, we were never able to reproduce the problem that was reported here. Have you tried looking at the KB article I linked above?
If you are binding to a DataSource that has the same structure at run-time as your design-time setup, then the column properties will be maintained.
When this does not work, it's most often because the data sources do not match up exactly. Make sure you get the names of the bands correct, in addition to the columns.
Has this been resolved? If I manually define the column widths in 2011.1, the column widths reset to the defaults and not what I've set at design time. I am supplying a manual data source.