
Hi.
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:RadGridView.FilterDescriptors
>
<
telerik:FilterDescriptor
Member
=
"IsEcoGenerated"
Operator
=
"IsEqualTo"
Value
=
"false"
/>
</
telerik:RadGridView.FilterDescriptors
>
<
telerik:RadGridView.Columns
>
<
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}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
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.
9 Answers, 1 is accepted
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:
myGridView.Items.EditItem(
this
.myGridView.CurrentItem);
// change the value
myGridView.Items.CommitEdit();
Does this solve your problem? Best wishes,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>



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.
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.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Raise a CollectionChanged event for your source collection - how?
My collection is a BindingList, I don't see how to raise a CollectionChanged event and what to put into it to tell the grid to update the visual items representing the CurrentItem.
This means that the collection bind to the ItemsSource of RadGridView should implement the INotifyCollectionChanged interface. An example for such collection is the ObservableCollection<T> class. When adding or removing items in the collection the CollectionChanged event is raised.
It looks like the BindingList doesn't implement the INotifyCollectionChanged interface, so this option won't be available for you unless you change the collection type.
Generally speaking, in WPF is recommended to use collections that implement INotifyCollectionChanged in order to ensure that the UI will get updated when the underlying collection is updated.
One more approach that you can use to reset the filtered items is to call the Reset() method of RadGridView's FilterDescriptors collection.
this.gridView.FilterDescriptors.Reset();

The approaches listed by my colleague below are the only available ones with the current implementation of the control.
Regards,
Dilyan Traykov
Telerik by Progress

I have a similar problem, but instead of changing an item in the collection the problem is adding a new item to the collection.
When I have FilterDecriptors added to the QueryableCollectionView my RadGridView does not update when new values are added to the list. However, if I remove the FilterDescriptors the new item is added.
Does anyone know how to fix this, so that my RadGridView does get updated when I have FilterDescriptors attached to it?
Hello Martin,
You can use the approaches listed in the previous post. Or alternatively, you can try to call the Reset() method of the FilterDescriptors collection of RadGridView.
radGridView.FilterDescriptors.Reset();
Regards,
Martin Ivanov
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.