This is a migrated thread and some comments may be shown as answers.

WPF RadGridView Filter

6 Answers 459 Views
GridView
This is a migrated thread and some comments may be shown as answers.
imad
Top achievements
Rank 1
imad asked on 31 Mar 2010, 06:53 PM
Hi,

I have 2 questions regarding the filtering behavior in WPF RadGridView, The first is how to get a DataTable from the filtered data without looping over the records property (maybe generate a Linq Expression from the FilterDescriptors).

The Second is how to clear all filters by code, i tried FilterDescriptors.Clear() this will cancel the filter for the data records but the filter interface still have checkboxes on the previous selected values.


Thanks.

6 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 01 Apr 2010, 10:02 AM
Hi imad,

1. If you have filtered RadGridView, you can access the filtered data through its Items property -- this will give you only the items that are currently visible.

2. RadGridView.FilterDescriptors.Clear()  is the correct way to do it. It will not leave any UI indications as demonstrated in the sample project that I have attached.

P.S. The "Select All" check-box might be left in indeterminate state (i.e. a dash), but we have logged this bug and will fix it as soon as possible.

Sincerely yours,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
ClausDC
Top achievements
Rank 1
Iron
answered on 22 Apr 2010, 08:03 AM
Question to 1.: Is there any way to bind to the "Items" Property? If not, is there any way to bind to some property of the GridView which gives me the filtered data? I'm using MVVM and it would be very helpful to access this information via data binding.
0
Vlad
Telerik team
answered on 22 Apr 2010, 08:06 AM
Hello,

Indeed Items will respect filtering however you can bind this property only one way since there is no public setter.

Sincerely yours,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
ClausDC
Top achievements
Rank 1
Iron
answered on 22 Apr 2010, 08:20 AM
Yeah, but how? "Items" doesn't seem to be accessible for binding.

If I use

<tk:RadGridView.Items>
                <Binding Path="VisibleItems" Mode="OneWay"></Binding>
            </tk:RadGridView.Items>


for example I get an error stating:

"The property 'RadGridView.Items' cannot be set because it does not have an accessible set accessor."

0
Vlad
Telerik team
answered on 22 Apr 2010, 08:32 AM
Hi ,

The idea is that you can bind something to Items instead Items to something.

Best wishes,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
ClausDC
Top achievements
Rank 1
Iron
answered on 22 Apr 2010, 08:45 AM
Ok but if I understand you correctly that would mean that I would have to do sorting and filtering myself because changes to the Items collection would come from my ViewModel. But I need the exact opposite - When filtering and/or sorting is done on the GridView-control I need the results in the ViewModel, is there any way to do this via binding?




Tags
GridView
Asked by
imad
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
ClausDC
Top achievements
Rank 1
Iron
Vlad
Telerik team
Share this question
or