Search code examples
wpfdatagridauto-update

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.


Solution

  • Yes, bind your datagrid to an ObservableCollection<T>, or even better, to an Asynchronous Multi-threaded ObservableCollection...