Hi again, there is a property in DataGridView called "AutoSizeColumnsMode". If the value of this property is set to "AllCells", the columns will expand to show all the texts they contain. Naturally, horizontal scroll bars will appear if the columns can't be fitted into the size of the DataGridView.
I need the same functionality in UltraGrid. I've searched through the forum but couldn't find any. Tried various properties but couldn't get the effect. Could you excellent people help me out again here please?
Edit Note: if no such property exists, could someone point me to the property that makes the grid fill up the whole size? I found that property but seems I lost it now and can't find it again. Although I would really prefer the first option.
This can be done in the WinGrid, but not by a property. It's a method:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand); }
This method to autosize all of the columns was added in v8.3. In any prior version, you will need to loop through the columns and call PerformAutoResize on each one.
sari211 said:Edit Note: if no such property exists, could someone point me to the property that makes the grid fill up the whole size? I found that property but seems I lost it now and can't find it again. Although I would really prefer the first option.
The property you are looking for is AutoFitStyle.
Thanks to both of you for your answers. Since Mike's answer was a single method call, that's the way to go for me instead of making a loop of method calls. Thank you once again.