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

[Solved] How can I change the default operator for a text column filter?

4 Answers 86 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark
Top achievements
Rank 1
Mark asked on 09 Apr 2014, 10:27 AM
I would like to change the default behaviour of a Text column filter control.
Currently, the default operator is set to 'Is Equal To', but I would like it to default to "Contains".

I tried deriving from DataGridTextFilterControl and overring the BuildDescription method.
However, this approach failed because it tried to apply a wrong theme.

Is there a way to achieve this?


4 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 14 Apr 2014, 01:17 PM
Hello Mark,

Thank you for contacting us.

I have attached a sample project that demonstrates how you can change the default text operator of the filter control. First you can create a custom filter control that inherits from DataGridTextFilterControl and override its Initialize() method where you can change the default operator. Then you have to create a custom command that inherits from DataGridCommand class with command Id = FilterButtonTap. You have to override the Execute(...) method  to change the filter control with the custom one. Finally, add the custom command to the RadDataGrid.Commands collection.

I hope this helps.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mark
Top achievements
Rank 1
answered on 26 May 2014, 10:42 AM
Hi Rosy,

I didn't had the time to process your response until now.
Thank you for your solution, it works perfectly.
However, I would also like to change the case sensitivity in this control. (to be non-case sensitive)
Could you help me with this as well?

kind regards,
Mark
0
Rosy Topchiyska
Telerik team
answered on 28 May 2014, 04:36 PM
Hello Mark,

Thank  you for writing.

You can enable/disable the case sensitivity with the "aA" button next to the TextBox in the filtering UI.

Please, let us know if you have other questions.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mark
Top achievements
Rank 1
answered on 05 Jun 2014, 11:24 AM
Hi Rosy,

Thanks for you answer. 
Actually I wanted to know if I could programmatically default the state of that button to 'case insensitive'.
But I allready figured it out.
There is a property IsCaseSensitive on the DataGridTextFilterControl from which the custom filter control is derived.
Setting this property to false inside the initialize method achieves the correct behaviour.

kind regards,
Mark
Tags
Grid for XAML
Asked by
Mark
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Mark
Top achievements
Rank 1
Share this question
or