Two way binding with IQueryable, MVVM and EF not refreshing RadGridView control

2 posts, 0 answers
  1. Eduardo
    Eduardo avatar
    1 posts
    Member since:
    Jun 2016

    Posted 25 Jun 2016 Link to this post


    Due to project requirements for a big customer I need to bind entity framework 6 dbcontext directly to telerik controls, in this case to a radgridview control, so i need to use IQueryable instead of ObservableCollection also to perform filtering, sorting and so on.  

    The point is that when I add, delete a customer from dbcontext, the radgridview don't refresh showing changes.  Also when I perform this operations directly in database, after refreshing dbcontext the radgridview not showing changes.

    I tried to implement INotifyPropertyChanged and INotifyCollectionChanged in my view model but without success.  

    Also I want to point out that due to mvvm pattern design I can't have code in mainwindow.xaml.cs.

    Please, anyone can provide me a full example of how to achieve this? 

    Thanks in advance.
  2. Dilyan Traykov
    Dilyan Traykov avatar
    617 posts

    Posted 29 Jun 2016 Link to this post

    Hello Eduardo,

    I'm afraid that RadGridView is only responsible for responding to changes in the underlying data context and only if the bound objects implement the INotifyPropertyChanged interface. You should design your application in such way that it responds to changes in your DbContext which, by default, in no way notifies on its change.

    Here are a few articles I found, discussing similar issues:
    Update databound datasource in c# when data in database changes
    Managing DbContext in WPF MVVM application
    How do I Refresh DbContext

    I hope you find these helpful.

    Dilyan Traykov
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top