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
285
Best practice to call CalculateAutoResizeWidth
posted

Hi,

I am using ultra grid and one of the requirement is that we have to size every column to the size of column values. The grid data set has almost 90+ columns and 1000 rows.

To support above requirement, i am calling CalculateAutoResizeWidth method on each column after binding the dataset.

 

I need to know if I should be  suspending paint by calling SuspendPainting before I make call to CalculateAutoResizeWidth ?

What is the best practice?

Reason I am asking is, I see a flicker if I set SuspendPainting = False,however, it does not happen if I don't set it.

Please let me know...

Also, is there a better way in Infragistic to size column this way?

Please let me know...

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    CalculateAutoResizeWidth simply returns the ideal width of the column. It has no effect on the UI and it does not change the width of the column. So you should not need to suspend anything.

    If you are called PerformAutoResize on the column (or setting the column's Width property), then this would, of course, cause the display to change. In that case using BeginUpdate/EndUpdate is probably a good idea.

    I'm not sure what SuspendPainting is. I've never heard of that method and I did a search but could not find any reference to it. So I'm guessing that must be a method in your code.