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

Filter Cell content by string operations like 'StartsWith'

1 Answer 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Stephan Ziep
Top achievements
Rank 1
Stephan Ziep asked on 03 Dec 2009, 10:29 AM
Hi,
My gridview is bound to collection of business objects that are generated by Linq2SQL. Some columns are bound to plain properties (string, int, etc.) while other columns are bound to entire objects like so....
<telerik:RadGridView.Columns> 
               ... 
                <telerik:GridViewDataColumn Header="ID" IsReadOnly="True" DataMemberBinding="{Binding Path=Id}" 
                                            DataType="{x:Type System:Int32}" /> 
 
                <telerik:GridViewComboBoxColumn Header="Items" 
                                                DataType="{x:Type local:MyItem}"  
                                                ItemsSource="{Binding ElementName=MyWindow, Path=ViewModel.AvailableItems}" 
                                                DataMemberBinding="{Binding Path=SelectedItem}" 
                                                DisplayMemberPath="ItemName" 
                                                SelectedValueMemberPath=""/> 
                 ... 
</telerik:RadGridView.Columns> 

Everything is working fine so far, except for the column filtering options. I want to be able to filter the 'Items' column like if it was of type string. I want to be able to choose "StartsWith" or "Contains" from the FilterEditor. All I see are equality operations to choose from. Is this somehow possible without reverting the column datatype to 'string' or having to write a custom filter editor?

Thanks,
-Stephan Ziep

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 04 Dec 2009, 09:34 AM
Hi Stephan Ziep,

Currently, such custom behavior is not support out of the box. What you could do though, is to create a Custom Filtering Control that will add/remove special FilterDescriptors to RadGridView's FilterDesctiptors collection. These special FilterDescriptors should filter by "MyItem.ItemName".

To learn how to create such a control, please refer to my blog post Custom Filtering with RadGridView for Silverlight. It is for the Silverlight platform, but since our controls share a common  code base it will be absolutely the same for the WPF platform. No difference at all.

You can see the implementation of another two custom filtering controls in our online Custom Filter Controls example.

For a future version we will try to implement filtering, sorting and grouping by the DisplayMember of a combo box column.

I hope this helps.

Greetings,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Stephan Ziep
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or