DataGrid not updating when removing Row with RowFilter

P

PeterB

Hello!

I have a DataGrid with a DataTable as DataSource. If I change the data of a
row in a datagrid so that this row is affected by a rowfilter (and thus
should be filtered away), the row isn't removed instantly. But if you change
cell the row is removed from the grid...

So...

I have a grid with several rows.
I apply a RowFilter. This removes some of the rows... ok so far.
I have a ContextMenu on the DataGrid with which I can change the value of a
cell (which the RowFilter triggers on) to make it disappear.
This means I click the row to be deleted, the ContextMeny pops up and I
select remove.
The value in the cell is changed but the Filtering is never fired.
If I move to another cell the row is finally removed from the grid.

1. Is this a known bug/feature?
2. Is there any way I can force the DataGrid to Update (without changing
cell)? None of Refresh(), Update(), Invalidate() works...

thanks,

Peter
 
P

PeterB

I found the solution myself by using DataTable.AcceptChanges right after I
change the value of the cell.



The DataView only shows a cache of the datatable, when changing a row in the
datagrid the changes isn't reflected on the actual table immediately (until
you move away from the current cell). Using DataTable.AcceptChanges() solves
this.



/ Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top