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

Replace all filters with custom FilteringControl

1 Answer 66 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 24 Oct 2013, 02:21 PM
I have build a custom FilteringControl for my RadGridView and got it to work on the following way:

<telerik:RadGridView.Columns>
    <telerik:GridViewDataColumn Header="Value" DataMemberBinding="{Binding Path=RowValue}"
       FilteringControl="{StaticResource ResourceKey=ViFilterControl}" />
</telerik:RadGridView.Columns>

My custom filtering control implements the IFilteringControl interface.

In our application there are many RadGridViews with many columns, so I want to make a kind of Style with ControlTemplate to force every filter to use my custom filter control, instead of implementing my custom filter control on every column definition.
The way I tried to solve my problem is:

<Style x:Key="FilteringControlStyle" TargetType="telerik:FilteringControl">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Type=telerik:FilteringControl}">
                <wpfApplication1:FilterControl />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
<Style TargetType="{x:Type Type=telerik:FilteringControl}" BasedOn="{StaticResource ResourceKey=FilteringControlStyle}" />

When I press the funnel on the gridview column my custom filter shows up, but the list stays empty. The cause of this is that the Prepare method of the IFilterControl is never called.

What am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 29 Oct 2013, 11:42 AM
Hello Eric,

 


Thank you for contacting us! Rather unfortunately there is no easy way to embed your own custom filtering control with a global implicit style. RadGridView columns are designed to work with built-in FilteringControl, the implicit style can't tell to a column to ignore the built-in one and to use yours. By that reason you are setting your own custom controls to each column separately. Another option would be to define your own custom column, which internally works with custom filtering control.    
Hope this helps!



Regards,
Vanya Pavlova
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Eric
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Share this question
or