WinForm DataGridView Filtering

I have a DataGridView control that is bound to a custom typed list (which inherits a BindingList). I would like to be able to filter rows based on a simple column value (type bool). Ultimately, the goal is to mark the item as deleted, but just mark it as deleted in the DataSource, and not delete it. Juste remove it from the grid, not from the DataSource.

Any idea?

+3
source share
2 answers

You can use LINQ to filter your data, and then create a new BindingList and reassign it to dataGridView.

, person, WillBeDeleted:

dataGridView1.DataSource = new SortableBindingList<Person>
                           (SampleData.Where(p => !p.WillBeDeleted).ToList());

!

+4

, SortableBindingList http://www.timvw.be/presenting-the-sortablebindinglistt-take-two/ ( VB.NET)

, SortableBindingList .

Private mListeNotes SP1ZSortableBindingList ( SP5004ZNoteEvolutiveEntite)

, , . , , .

0

Source: https://habr.com/ru/post/1774115/


All Articles