Hi~
I'm using UltraGird with 2,000 columns in grouplayout.
And, I want to change all column's width by combobox(30, 50, 70, Auto, and so on.) that I make.
then, it works very well wihile I don't select the "Auto" item in combobox.
But, if I select the "Auto" item, "UltraGridColumn.PerformAutoResize(~);" is called, and I change the combobox item to "30" again,
"UltraGridColumn.Width = 30;" is not working.
and if I use the property "UltraGridColumn.RowLayoutColumnInfo.ActualCellSize", it works.
But, I have 2,000 columns in my grid, and it takes too long!
How can I solve this problem? Help me, please!
ok, thanks Mike~!
Hi,
The problem is that there are two different methods of setting the width of the column at work here. When you are using RowLayoutStyle (ColumnLayout or GroupLayout), the width of the column is determined by the column's RowLayoutColumnInfo properties like PreferredCellSize and PreferredLabelSize. These properties override the Width property on the column. This is not a problem as long as you don't set these properties to anything - the grid falls back to the Width property by default. But once the user sizes the column or you call PerformAutoSize, these properties are getting set and once they are set the Width property is ignored.
So what you should do is change your ComboBox code so that instead of setting the Width property on the column, you set the PreferredLabelSize.Width and the PreferredCellSize.Width. You can set the Width property, also, if you like, but it's not necessary.