Hi,
When I set a column width it doesn't always set correctly. I am setting the UltraGridColumn.Width for each column in each band. I am using an older version of the grid, v6.2 but what I'm trying to do is very basic.
Is this a known issue? Or am I doing something wrong?
There are a number of reasons why this might not work the way you are expecting it to.
By default, the column widths are synchronized across all bands. So when you set the width of the first column in the root band and then set the width of the first column in the child band, the root band column width is changed along with it.
To allow the columns width to be set freely, do this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridOverride ov = layout.Override; ov.AllowColSizing = AllowColSizing.Free; }
Another possibility is that you have AutoFitStyle turned on, which automatically adjusts the widths of the columns so that they fit within the visible area of the grid. This, of course, means that changing the width of any one column will change the width of every other column. The only way around that is to turn off AutoFitStyle.
I have observed a similar behavior that I believe to be unrelated to the settings mentioned.
It seems the width has some initial value that is automatically calculated and is subject to change. The width also appears to keep track of whether it has been set to some positive value. However, if the initial setting of the width happens to be the width being automatically calculated, then no change is made, not even to the state that determines that the width has been set. Thus, if the value automatically calculated changes for whatever reason, then the width changes, even though it has been set.
I have observed this behavior in version 2012.1.2008. You should be able to work around this by setting the width to some other value before setting it to the desired value.
Jon Scharff