Wpf Datagrid数据上下文 [英] Wpf Datagrid Datacontext

查看:357
本文介绍了Wpf Datagrid数据上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


感谢您对我上一篇文章的回答.现在我有一个新问题
我正在通过代码在数据库中添加一行.但是,直到我没有关闭该窗口并重新打开,新行才显示在数据网格中.我应该在哪里使用InotifyPropertychanged接口,因为我将实体框架与Sqlserver Ce3.5一起使用.


I am thankful of you for my previous post''s answer. Now I have anew Problem
taht I am adding a row in the database through code. But the new row is not showing in the data grid until I not closed that window and reopen. Where should I use InotifyPropertychanged interface because I am using entity framework with Sqlserver Ce3.5.

推荐答案

如果要用其类实现INotifyPropertyChanged的对象集合填充Datagrid,确保集合是可观察的类型,然后,在执行插入操作后,只需调用PropertyChanged事件即可.

参考:
http://msdn.microsoft.com/en-us/library/system.componentmodel. inotifypropertychanged.aspx [^ ]
If you are populating your Datagrid with an object collection whose class implement INotifyPropertyChanged, make sure the collection its an observable type, then, after you perform the insert operation just call the PropertyChanged Event.

Reference:
http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx[^]


这篇关于Wpf Datagrid数据上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆