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

Custom Filter for AutoGenerated Columns

1 Answer 109 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
gans
Top achievements
Rank 1
gans asked on 23 May 2012, 08:08 PM
In our TreeListView, we define only TreeListView part at design time. Columns are Auto Generated. We don't add columns from the code behind also. I need to have custom filter for few columns. 

From your demo example, I found that you need to define the filtering Column like this in XAML. 

<telerik:GridViewDataColumn.FilteringControl>
                        <local:FromDateToDateFilterControl FromDate="1/1/1863" ToDate="1/1/1933"/>
 </telerik:GridViewDataColumn.FilteringControl>

I want to know how can I define this when my columns are Autogenerated?

What if I want to have different Custom Filters for different columns? 

Could you please let me know to achieve this?



1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 24 May 2012, 09:07 AM
Hi,

You should do it in the same way as you would do it in XAML. Attach to the AutoGeneratingColumn event of the grid. In the event handler, you will have a reference to the column being autogenerated. Then create a new instance of your custom filtering control and assing it to the column.FilteringControl property. You can check which column is which by reading its UniqueName or DataMemberBinding.Path.Path.

I hope this helps.

All the best,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TreeListView
Asked by
gans
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or