Auto Update DataGrid after data insert/delete
I'm using LINQ to entities to insert and delete data from a DataGrid that is 开发者_如何学运维displayed on the homepage of my WPF application. I was wondering if there was a way or a DataGrid feature that would make my DataGrid auto-update and show changes upon insert/delete by itself rather than me having to re-execute the LINQ query that fills the datagrid (which is how i am achieving this now).
Thanks in advance.
Yes, bind your datagrid to an ObservableCollection<T>
, or even better, to an Asynchronous Multi-threaded ObservableCollection...
精彩评论