开发者

Add Non-DataSource Item to ListView

开发者 https://www.devze.com 2023-03-01 00:31 出处:网络
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 ab

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消