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

Filtering data in RowDetails

1 Answer 79 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
lori guymon
Top achievements
Rank 1
lori guymon asked on 28 Mar 2011, 11:18 PM
I have a RadGridView that displays Orders and a RowDetails template containing another RadGridView showing the OrderDetails records for the Order.  This works great. 

Now all I want to do is filter the OrderDetails records so the user can see some or all of the OrderDetail records based on the post date selection at the top of the form.  I thought this would be simple but I'm spinning my wheels.  I first created a FilterDescriptor for the PostDate member in xaml and was hoping to bind the value to a property containing the selected Post Date in my ViewModel.  I think this would work but it doesn't as I finally realized the datacontext of the OrderDetails grid is really the "Order" and not my ViewModel (so it can't "see" my PostDate value).

Am I heading in the wrong direction and\or are there better ways to accomplish what I am trying to do? 

Any help would be greatly appreciated!

Note:  I know I can turn filtering on in the RadGridView for the Post Date column and the user can use the little filter icon but I do not want to do this.  I have a combobox control at the top of the grid for the user to select from instead.

1 Answer, 1 is accepted

Sort by
0
lori guymon
Top achievements
Rank 1
answered on 29 Mar 2011, 01:28 AM
I discovered that if I created a StaticResource for my viewmodel (ie: MyViewModel), I can then setup binding for the "Value" property of the FilterDecriptor to point a property in my viewmodel that I would like to use as the filter of my data.  Like so:

<telerikGridView:RadGridView.FilterDescriptors>
 <telerikData:FilterDescriptor Member="PeriodDisplay"
   Operator="IsEqualTo" 
   Value="{Binding Source={StaticResource MyViewModel},Path= SelectedStatementPeriod.PeriodDisplay}"
   IsCaseSensitive="True" />
</telerikGridView:RadGridView.FilterDescriptors>

This seems to do the trick!
Tags
GridView
Asked by
lori guymon
Top achievements
Rank 1
Answers by
lori guymon
Top achievements
Rank 1
Share this question
or