You can manipulate a bound list as the grid will call the count and index properties of the IList for instance. When you want to insert a new row increment the count and whereever you want to insert the new row, when the grid says can I have the data for row x then the index property can return the new rows data. All the other rows will be at x+1.
I think the problem that maybe alot of people have (I know I do) is the idea of seperating View from Model when using the grid. The grid is the view on a list of data which is the model and to seperate them makes life a whole lot easier and more powerful.
Inserting into the middle of a collection of datarows somewhere doesn’t matter, it’s only important to insert it into the middle of your model list and the grid will view the state of the model (adding/inserting rows where necessary). The view can then sort it’s data, hide it’s data change it’s data without affecting the model and that’s the key.
I believe that a databound grid (with custom binding) although takes a while to setup is far more powerful than an unbound grid because of the seperation you get.
It’s just a thought.
Imported from legacy forums. Posted by Chris (had 343 views)