I have a fairly basic 3 band grid and I am doing auto resize of visible rows within InitializeLayout() handler (calling PerformAutoResize(PerformAutoSizeType.VisibleRows) for each column in the 2nd band) and then calling it again within BeforeRowExpanded so that newly expanded row cells get auto-resized. I noticed that PerformAutoResize(PerformAutoSizeType.VisibleRows) does not seem to resize the newly expanded row for whatever reason, the width of the cell is set to width of the column header (even though all data has been bound). However, as soon as I expand one of the other top level nodes within the grid, I see the width of the cells within the first expanded row change and become what it should have been when the row was expanded.
To me it looks like some sort of a 'refresh' issue however Application.DoEvents() does not seem to help. I am using NetAdvantage 2009 V2. Any input will be appreciated? Is this a known issue? Thanks.
Thanks Mike, you're absolutely correct about specifying the number of rows to resize. AfterRowExpanded did not work for me so I went ahead with activating child row(s) and performing resizing within AfterRowActivated but I suppose calling grid.Update() is a simpler solution.
Why don't you try passing a number into PerformAutoResize. Try 20. That should be more than enough rows to fill the screen and small enough so that it will be very fast.
You could try using AfterRowExpanded, but I'm not sure that will work any better because the parent row will be expanded, but that doesn't necessarily mean that the grid has painted the child rows, yet. If it doesn't work in AfterRowExpanded, try calling grid.Update first, then use PerformAutoResize(VisibleRows). The call to Update should force the grid to paint the rows so they are visible.
I think you might be right about child row(s) not being visible (yet ) within BeforeRowExpanded event handler however I cannot use AllRowsInBand argument as it takes 45 seconds to complete (my grid has a large number of visible columns so it takes forever to size all of them). Perhaps I can force activate the expanded child row and do resizing within the AfterRowActivate or should AfterRowExpanded event suffice in this case? Thanks.
Hello ,
Probably it is not very good approach to PerformAutoResize(PerformAutoSizeType.VisibleRows) in BeforeRowExpanded event, because in this event the rows are still hidden and auto size shouldn’t affect them. My suggestion is to call
ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(false, Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand, true);
Please try this suggestion and let me know for the result.