RadDataFilter Annotations drawback

5 posts, 1 answers
  1. Ronald
    Ronald avatar
    12 posts
    Member since:
    Aug 2010

    Posted 10 Dec 2010 Link to this post

    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
  2. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 10 Dec 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ronald
    Ronald avatar
    12 posts
    Member since:
    Aug 2010

    Posted 10 Dec 2010 Link to this post

    Thank you for the quick response!

    This is exactlywhat i was looking for.

    Thanks!

    Regards
    Ronald Steenbergen
  5. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 09 Feb 2012 Link to this post

    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.
  6. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 10 Feb 2012 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready