The following code attempts to size a one column Ultragrid to the size as it's column after executing a PerformAutoResize. The column is filtered with each key typed into uxInput. The problem is that the filter works but the PerformAutoResize is based on the pre-filtered list. What am I missing?
Thanks,Jeremy
Private Sub OnInput_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles uxInput.ValueChanged
With uxSuggestionList.Rows.ColumnFilters(0) .ClearFilterConditions() If Not String.IsNullOrEmpty(uxInput.Text) Then Dim column As UltraGridColumn = uxSuggestionList.DisplayLayout.Bands(0).Columns(0) .FilterConditions.Add(New FilterCondition(column, FilterComparisionOperator.Contains, uxInput.Text)) End If End With
column.PerformAutoResize() uxSuggestionList.Width = column.Width
End Sub
Hi,
When you call the parameterless overload of PerformAutoResize, I think it's supposed to just size the visible rows. So I would think this should work. Unless maybe you are also setting ColumnAutoSizeMode and the PerformAutoResize is falling back to that property as the default.
Try explicitly specifying only visible rows:
column.PerformAutoResize(PerformAutoSizeType.VisibleRows) and see if that helps.
If not, then my guess is that it's because filtering is done asynchronously, so the rows aren't filtered out until the next time the grid paints, which means the rows will actually be visible when you call PerformAutoResize. I'm not sure there is any way around that, but you might be able to handle the BeforeRowFilterChanged event and set e.ProcessMode to Synchronous. Assuming this event fires when you add a filter programmatically, this will force the filtering to be done synchronously and that might work if I am right about this.
If none of that works, I recommend that you Submit an incident to Infragistics Developer Support so they can check it out.
Hi Mike.
Your assumption about asynchronous filtering appears to be correct. However, setting e.ProcessMode to Synchronous in the BeforeRowFilterChanged has no effect. Also, BeforeRowFilterChanged doesn't fire when a filter is set programatically (a bug in and of itself) so I testing by enabling the manual filter row.