I am programmatically filtering my gridview. The gridview has about 2000 rows, with a column called "Tag" of type uint that has a unique value for each row. In another control, my application user can select or unselect the Tags he wants to see in the gridview.
I'm using DistinctFilter as shown below. I'm seeing very poor performance and even a stackoverflow apparently coming from ResumeNotifications (no stack trace is available for that).
When the user wants to show all 2000 rows, no filtering is needed so that works fine. But when a single row is to be filtered out, I would AddDistinctValue 1999 times.
Is there some better way I should be doing this?
I'm using DistinctFilter as shown below. I'm seeing very poor performance and even a stackoverflow apparently coming from ResumeNotifications (no stack trace is available for that).
When the user wants to show all 2000 rows, no filtering is needed so that works fine. But when a single row is to be filtered out, I would AddDistinctValue 1999 times.
Is there some better way I should be doing this?
GridViewColumn tagColumn =
this
.gridView.Columns[
"Tag"
];
IColumnFilterDescriptor tagFilter = tagColumn.ColumnFilterDescriptor;
// Suspend the notifications to avoid multiple data engine updates
tagFilter.SuspendNotifications();
tagFilter.DistinctFilter.Clear();
foreach
(var pair
in
myDictionary)
{
if
(pair.Value.IsShown)
{
tagFilter.DistinctFilter.AddDistinctValue(pair.Key);
}
}
// Resume the notifications to force the data engine to update the filter.
tagFilter.ResumeNotifications();