This question is locked. New answers and comments are not allowed.
So I'm trying to develop a proper MVVM solution with RadGridView and some FilterDescriptors. I've read on forums in some old posts that FilterDescriptor don't support binding, but you were supposed to add it...and looking at it now, it indeed looks like FilterDescriptor is a DependencyObject (I'm running version 2011.1.419.1040). So here's what I tried:
This does actually work, but isn't very dynamic (just showing snippets of the code here and there are columns in the grid). Back to the drawingboard.
This doesn't work at all. It seems like the FilterDescriptor can't locate the SearchTermTextBox. If that is the case, what's the point of adding support for binding on a FilterDescriptor? Seems kind of odd to me. I've tried a few other different approaches with no luck as well. Looking at the demo (http://demos.telerik.com/silverlight/#GridView/Search) doesn't help either. I'm not going to add the GridView in my viewmodel as suggested there.
Bottom line...is there a proper MVVM way to use this functionality?
<
telerik:RadGridView
Grid.Row
=
"2"
x:Name
=
"BudgetGrid"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"False"
Background
=
"{StaticResource LightGreyBackground}"
ItemsSource
=
"{Binding Posts}"
RowDetailsVisibilityMode
=
"Collapsed"
RowIndicatorVisibility
=
"Collapsed"
CanUserDeleteRows
=
"False"
CanUserInsertRows
=
"False"
CanUserSelect
=
"True"
SelectedItem
=
"{Binding DataContext.SelectedPost,Mode=TwoWay, ElementName=LayoutRoot}"
DataContext
=
"{Binding Budget}"
ShowColumnFooters
=
"True"
>
<
telerik:RadGridView.FilterDescriptors
>
<
telerik:FilterDescriptor
IsCaseSensitive
=
"False"
Member
=
"Name"
Operator
=
"Contains"
Value
=
"Upd"
/>
</
telerik:RadGridView.FilterDescriptors
>
</
telerik:RadGridView
>
This does actually work, but isn't very dynamic (just showing snippets of the code here and there are columns in the grid). Back to the drawingboard.
<
TextBox
x:Name
=
"SearchTermTextBox"
Grid.Column
=
"0"
Width
=
"150"
VerticalAlignment
=
"Center"
>
<
i:Interaction.Behaviors
>
<
behaviors:UpdateOnTextChangedBehavior
/>
</
i:Interaction.Behaviors
>
</
TextBox
>
<
telerik:RadGridView
Grid.Row
=
"2"
x:Name
=
"BudgetGrid"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"False"
Background
=
"{StaticResource LightGreyBackground}"
ItemsSource
=
"{Binding Posts}"
RowDetailsVisibilityMode
=
"Collapsed"
RowIndicatorVisibility
=
"Collapsed"
CanUserDeleteRows
=
"False"
CanUserInsertRows
=
"False"
CanUserSelect
=
"True"
SelectedItem
=
"{Binding DataContext.SelectedPost,Mode=TwoWay, ElementName=LayoutRoot}"
DataContext
=
"{Binding Budget}"
ShowColumnFooters
=
"True"
>
<
telerik:RadGridView.FilterDescriptors
>
<
telerik:FilterDescriptor
IsCaseSensitive
=
"False"
Member
=
"Name"
Operator
=
"Contains"
Value
=
"{Binding ElementName=SearchTermTextBox,Path=Text}"
/>
</
telerik:RadGridView.FilterDescriptors
>
</
telerik:RadGridView
>
This doesn't work at all. It seems like the FilterDescriptor can't locate the SearchTermTextBox. If that is the case, what's the point of adding support for binding on a FilterDescriptor? Seems kind of odd to me. I've tried a few other different approaches with no luck as well. Looking at the demo (http://demos.telerik.com/silverlight/#GridView/Search) doesn't help either. I'm not going to add the GridView in my viewmodel as suggested there.
Bottom line...is there a proper MVVM way to use this functionality?