Custom Filter for AutoGenerated Columns

2 posts, 0 answers
  1. gans
    gans avatar
    48 posts
    Member since:
    Jan 2012

    Posted 23 May 2012 Link to this post

    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?



  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 24 May 2012 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top