GridView not updating when property on item is changed

8 posts, 0 answers
  1. Odd Veibust
    Odd Veibust avatar
    26 posts
    Member since:
    Feb 2007

    Posted 13 Sep 2011 Link to this post


    I have a grid with FilterDescriptors set to a property on the items in the grid.

    <telerik:RadGridView x:Name="ContractNoteGridView"
    ItemsSource="{Binding ContractNotes}">
    <telerik:FilterDescriptor Member="IsEcoGenerated" Operator="IsEqualTo" Value="false" />
    <telerik:GridViewDataColumn Header="Dok.Nr." DataMemberBinding="{Binding DocumentNumber}" />
    <telerik:GridViewDataColumn Header="Dato" DataMemberBinding="{Binding Date, StringFormat={}{0:dd.MM.yyyy}}" />
    <telerik:GridViewDataColumn Header="Eco" DataMemberBinding="{Binding IsEcoGenerated}" />

    The filter is working ok when the GridView is loaded, item's are showing or not based on the property 'IsEcoGenerated'. The problem is that the GridView is not updated and removing item's if I set the property 'IsEcoGenerated' to true on one (or several) of the items. The GridViewDataColumn containing the same property does change though.

    The collection used in the ItemSource (ContractNotes) is an ObservableCollection of objects of type ContracNote. ContractNote has the property IsEcoGenerated, and it implements INotifyPropertyChange , the NotifyPropertyChanged is also triggered on the setter of the property.

    Can you give me a hint on what I'm doing wrong, or what I need to do to get the grid to update/refresh? The command that sets the property 'IsEcoGenerated' is a command on the ViewModel.

  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 16 Sep 2011 Link to this post

    Hi Odd Veibust,

    Do you set the value of the 'IsEcoGenerated' property from the UI or from code behind?
    If you change it from code behind, then the filter is not applied because a notification for a collection changed is not received by the GridView. 
    You should inform the GridView that the collection has changed. You may do this like so:

    // change the value

    Does this solve your problem?

    Best wishes,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Odd Veibust
    Odd Veibust avatar
    26 posts
    Member since:
    Feb 2007

    Posted 29 Sep 2011 Link to this post

    The property is changed on a command on the viewmodel of the object, I now tried to manually fire notifypropertychange on the collectionproperty (checked that it actually did fire), but the grid still doesn't refresh.
  4. tracstarr
    tracstarr avatar
    2 posts
    Member since:
    Oct 2006

    Posted 02 Mar 2012 Link to this post

    Did you ever figure this one out? I'm having the same issue and don't know how to get it working.
  5. Steve
    Steve avatar
    2 posts
    Member since:
    Oct 2011

    Posted 04 Apr 2013 Link to this post

    I am also fighting with this.  I have an MVVM framework.  

    The property (IsVisible) is being set in the Model.  The initial load of the screen appears to work but when IsVisible is changed from false to true, the row does not reappear in the gridview.  If I set IsFilteringAllowed = true and change a filter manually I can get it to appear, but this is not an ideal solution.  I need the property assignment to refresh the gridview filter. 
    Edit - I noticed this thread is in the WPF section.  I'm in Silverlight, but it appears to be the exact same problem. 
  6. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 08 Apr 2013 Link to this post


    Here I have listed the options you have in order to get the GridView updated when a value is changed from the source:
    1. Use the approach demonstrated in this help article.
    2. Invoke a GridView.Rebind()
    3. Raise a CollectionChanged event for your source collection.

    I hope this will help.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  7. John
    John avatar
    22 posts
    Member since:
    Aug 2014

    Posted 09 Sep 2016 in reply to Dimitrina Link to this post

    Has anything change since this post was submitted. Is there any other way to refresh the filters once the filtered properties change? Maybe through GridViewCell.SourceChanged?
  8. Dilyan Traykov
    Dilyan Traykov avatar
    617 posts

    Posted 12 Sep 2016 Link to this post

    Hello John,

    The approaches listed by my colleague below are the only available ones with the current implementation of the control.

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