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
490
CalculateAutoResizeWidth in a CellMultiLine = true grid
posted

I use an ultragrid to display a calendar. The content in the calendar has variable length, but the cells of the calendar need to be the same size. I do that by calculating the greatest width with CalculateAutoResizeWidth and then by assigning that width to all columns.

This worked fine when the cells were single line. Now, the content of the cells are required to be broken into two lines: first line the shift, second line the name of the person. I use CellMultiLine = true to display the two lines.

However, I cannot calculate the greatest width with CalculateAutoResizeWidth now. As a result, some cells are broken into three lines, where as a two line design is required strictly.

Is there a way to calculate the greatest width in this context, so that I can assign that width to all columns?

  • 490
    Verified Answer
    Offline posted

    I have solved this problem by moving the width calculation and column resizing to the data binding method after the data binding line. Now, these calculations happen after the handling of the InitializeLayout and InitializeRow events.

    I prefer such tasks to be handled in the handler of the InitializeLayout event, but if that is not an option, I have no problem using the method described above.