views:

725

answers:

1

Oout of the box the Infragistics UltraGrid control allows you to make the last column in a grid spring to fill the remaining unused portion of the grids bounding rectangle.

____________________________
| Col1 | Col 2 | Col 3---->|
|                          |

I have searched but cannot find a method of making a column that is not the end column spring to fill the width.

For example, a row that has a text description followed by a column that contains a button to perform some action. You want the text description to take most of the width, and have the column with the button butt up to the end of the grid's bounding rectangle.

__________________________________
| Text Col ------------>| Button |
|                                |

Has anyone got any experience of attempting to get the UltraGrid control to do this out of the box, or some hack to make it work?

+4  A: 

This can be done cleanly using the built-in Infragistics grid.

  1. Set the Grid.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns.
  2. Set the Width, MinWidth and MaxWidth properties of the columns that you want to remain within a fixed boundary (in my case, the column with the button is set to 150 wide)

All columns that have a fixed Min and Max width will float their width between the Min and Max you provide, and once they reach their Max they will stop growing, at which point all other columns that do not have a Max applied will keep growing and fill the remaining horizontal space.

Mark Allanson