Add Non-DataSource Item to ListView
It may just be that I haven't hit on the right pattern yet. I have a ListView displaying a list of records which is initially populated from a database. 开发者_如何学编程 Now, I want the user to be able to optionally or remove records and then at some point commit the new set of records. Until committed, nothing should happen in the database.
So, if there are 5 database records to display and the user chooses to add two records, two records will be appended to the control. They could then choose to remove a "real" record, a "fake" record, and a new "fake" record, and then commit.
At this point, I will reconcile the control with the database.
Everything here is fine, EXCEPT the part where I add a new record to the list view without reconsulting the database and then adding a record to the DataSource and rebinding.
The control already represents the proposed state, minus the requested new record.
How is this traditionally done?
精彩评论