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

RadDataFilter Annotations drawback

4 Answers 67 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Ronald
Top achievements
Rank 1
Ronald asked on 10 Dec 2010, 12:21 PM
Hi,

I would like to be able to set which fields are available for datafiltering on the RadDataFilter. As i understand, this can be done using annotations. However i find the use of annotations cumbersome. I use the RadDataFilter to filter data in a RadGridView. The  RadGridView is boud to a collection in the Viewmodel. Now in order to specify which fields are available for datafiletring, i would have to annotate the public fields of my viewmodel. I think this is a violation of seperation of View and Viewmodel. Moreover,  if i have diferent views using the same viewmodel with a RadDataFilter and i wish to have different fields available for filtering in each view, then this cannot be done.

In my honest opnion, which fields can be filtered, and what their caption is in the RadDataFilter should be specified in a collection of the RadDataFilter itself (much as the columns collection in the RadGridView).

If you think i going the wrong way here please let me know.

Kind regards,
Ronald Steenbergen

4 Answers, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 10 Dec 2010, 02:14 PM
Hello R,

This is absolutely possible.

You don't have to use annotations at all. You can set AutoGenerateItemPropertyDefinitions to false and then manually define the properties that you would like to show. This is done with through the ItemPropertyDefinitions collection. Each ItemPropertyDefinition has three properties:

- PropertyName
- PropertyType
- DisplayName

An online example can be seen here.

Let me know if there are problems.

Best wishes,
Ross
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Ronald
Top achievements
Rank 1
answered on 10 Dec 2010, 04:19 PM
Thank you for the quick response!

This is exactlywhat i was looking for.

Thanks!

Regards
Ronald Steenbergen
0
Rayne
Top achievements
Rank 1
answered on 09 Feb 2012, 06:22 PM
Hello. Is there a way to capture the event that auto-creates the definitions and cancel it if necessary? I'd like to autogenerate most but maybe there is 2 in the list of 10 that I don't want. Having to manually create the 8 I want is more work than just canceling the creation of the 2 I don't want.
0
Rossen Hristov
Telerik team
answered on 10 Feb 2012, 10:07 AM
Hi,

Unfortunately, there is no such event. You can mark your properties with data annotation attributes in case you do not want them auto-generated.

Greetings,
Ross
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
DataFilter
Asked by
Ronald
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Ronald
Top achievements
Rank 1
Rayne
Top achievements
Rank 1
Share this question
or