I have a grid where the column width doesn't change. I would like the height of the row to automatically increase to display the contents of the largest cell in the row. I have already set the DisplayLayout.Override.RowSizing = RowSizing.AutoFree but when scrolling the grid to display new records the rows don't seem to autosize. Is there any way to tell the grid to autosize the row height automatically all the time without having to do a performautosize for each row?Thanks, Ron
InitializeRow fires in a lot of different circumstances. It should fire whenever the row is initially created or when any value is changed. Basically, the main purpose of this event is so you can do things like color a row or cell based on it's value or autosize the row. So if it's not working, something is wrong.
Maybe you need to get the latest Hot Fix? Does PerformAutoSize have any optional parameters - maybe you need to pass something in to get it to properly size a row that hasn't been painted, yet.
Hi Mike,
Thanks for the reply. The problem I'm seeing is that the user can request that more data rows can be added to the grid. If these newly added rows get added to a "non visible" portion of the grid, and then the user scrolls down to see those rows, they are not autosized. This makes me ask if initializerow is being called for these rows. When exactly is initializerow called? BTW I add new rows by adding them to the underlying bound datatable, then do a updatedata() and refresh(). Any suggestions?
Addendum: what I ended up doing is scanning the "visible rows" in the "AfterRowRegionScroll" event and performing a "PerformAutoSize" on each of the visible rows.
Private Sub dg_AfterRowRegionScroll(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.RowScrollRegionEventArgs) Handles dg.AfterRowRegionScroll For Each vr As VisibleRow In e.RowScrollRegion.VisibleRows If Not vr.Row Is Nothing AndAlso Not vr.Row.GetUIElement(e.RowScrollRegion) Is Nothing Then vr.Row.PerformAutoSize() End If Next End Sub
Ugh! Is this the best (only) way to get these rows sized?
Hi Ron,
No, you have to call PerformAutoSize on the row. I would recommend doing this in the InitializeRow event.