Filtering data grid causes UI freeze

Juventino1897

New member
Joined
Feb 24, 2021
Messages
2
Programming Experience
1-3
Hi,
I have a small WPF application which gets some data (~300 rows) from an API and gets displayed in a DataGrid. Up to this point everything works well. Some Header-columns of the DataGrid have nested textboxes, which should serve as search-boxes. I bound their text to a property in my ViewModel and wrote a filter for the CollectionView. If I enter a filter-text everything is okay and I get the result I expect. The problem appears when I try to remove my filter-text again. When I want to remove the last character from the text-box the UI freezes for a few seconds. I think this comes from loading all the rows into the DataGrid again. Has anyone faced this problem as well?
Thanks for your help in advance!
 
What does your profiler say about where the most time is consumed? Is it from pulling data from the API or from stuffing data into the data grid?

If most of the time is from the API, and you are pulling the data from the API every time the filter changes? If so, can you change things so that you cache data locally and only pull from the API at some interval?

I kind of recall that there is also a way to do a "virtual" list where only the items of a collection is currently visible to the user is what is needed to be bound to the UI and other parts of the bound collection can be retrieved lazily and/or asynchronously.
 

Latest posts

Back
Top Bottom