I want to resize the columns based on the cells' text in all the rows. The grid's data source is set to a BindingSource. After setting the BindingSource's DataSource property to a list of entities, I want to resize the columns in the grid after it finished loading the data.
Is there any event that announces that? Or is there any event that tells me that the visible rows finished loading from the data source?
Thanks.
Hi,
DataBinding is an ongoing process, so it's never "finished". So no, there is no event for this.
But you don't need one. You can just do this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; layout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand); }
Sorry for the late response, but I needed a little time to play with it.
It partialy works, but I need more:
- auto resize columns on data source changed: InitializeLayout is not raised
- auto resize columns on filtered rows: the auto resize is applied on filtered out rows also
- the column headers are set to word wrap: if the columns are resized based only on cell text, I get a character wrap on number columns. I would like it to resize to a minimum width in which the header caption is readable
- I tried using PerformAutoSizeType.VisibleRows, but I need an event that tells me that the visible rows collection changed. I found the AfterRowRegionScroll for the WinGrid, but I could not found an equivalent for WinCombo
- Trying to resize the columns manually is cumbersome because I could not find an event that tells me when the data was loaded in the visible rows and when the visible rows collection changed.
I am still looking for a solution for this.
Thanks for your support,
Emanuel