从数据库中删除一个项目(实体)后更新ListView [英] update ListView after delete an item (entity) from Data base
问题描述
大家好,
我的问题是从数据库中删除实体后,我的列表视图没有更新
请你能帮我吗
谢谢
Hi guys ,
My problem is after delete an entity from the database my listview did not updated
please can you help me
Thanks
推荐答案
试试这个
1.在XAML中或在运行时使用Listview属性ItemSource
将ListView与
Hi, Try this
1. Bind your ListView with an
ObservableCollection<t></t>
绑定
2.在创建的这个ObservableCollection对象中从数据库中加载数据
3.删除数据库中的实体后,您有2个选择. fisrt直接从ObservableCollection对象中删除实体(性能更好,但如果您的应用程序在网络环境中运行,则将忽略其他用户所做的更改)或第二次从数据库中的ObservableCollection对象中重新加载数据.
希望可以帮助
in XAML or at runtime with the Listview property ItemSource
2. Load your Data From your database in this ObservableCollection object you created
3. After Deleting the the entity in your database you have 2 choice. fisrt delete the entity directly from your ObservableCollection object (better performance but will ingnore change made by other user if your application run in an network environnement ) or second Reload your Data From your database in then ObservableCollection object.
HOPE IT''S HELP
这篇关于从数据库中删除一个项目(实体)后更新ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!