Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
585
How to change column width after UltraGridColumn.PerformAutoResize()
posted

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!

Parents
  • 469350
    Verified Answer
    Offline posted

    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.

Reply Children
No Data