User (Old forums)MemberOctober 28, 2007 at 5:26 amPost count: 23064
I’m looking for the correct way to continuously filter the grid while a user is typing the filter criteria in a text box.
Currently I handle the TextChanged event on the text box and then initiate a new delegate. In this delegate I call
The problem I have is that the grid still does the refresh on the UI thread, since the UI still freezes directly after typing each character.
What is the correct way to this?
Imported from legacy forums. Posted by Barry (had 3190 views)User (Old forums)MemberOctober 28, 2007 at 6:51 pmPost count: 23064
Probably you shouldn’t call .Refresh() since it will rebind the grid. Can’t you just set DataGridCollectionView.Filter to filter what you need?
Imported from legacy forums. Posted by nat (had 438 views)User (Old forums)MemberOctober 28, 2007 at 11:40 pmPost count: 23064
I’ve tried to do that, but the UI still freezes for a few seconds after typing every character.
Here’s the code…
private delegate void FilterTreadDelegate();
void txtVoucherNumber_TextChanged(object sender,
private void FilterWorker()
DataGridCollectionView temp = (DataGridCollectionView)this.grid.ItemsSource;
temp.Filter = new Predicate<object>(FilterVoucher);
private bool FilterVoucher(object item)
vwVouchers ve = item as vwVouchers;
bool bReturnV = false;
if (txtVoucherNumber.Text.Trim() != “”)
bReturnV = true;
bReturnV = true;
Imported from legacy forums. Posted by Barry (had 546 views)Xceed SupportMemberNovember 8, 2007 at 10:28 amPost count: 5658
Reapplying a filter after each keystroke is not ideal since it will cause lags like the ones you are seeing. I suggest that you refilter the grid (by calling Refresh) when the Enter key or a button is pressed.
Imported from legacy forums. Posted by Jenny [Xceed] (had 4056 views)
- You must be logged in to reply to this topic.