Change Members DropDown in DataFilter

14 posts, 0 answers
  1. Pete
    Pete avatar
    67 posts
    Member since:
    Sep 2012

    Posted 28 Jun 2012 Link to this post

    Is it possible to change the Members DropDown (PART_SimpleFilterMemberComboBox) in the filter criteria to a treeview? We have a large number of fields that are listed at the moment and it is difficult for users to scroll through them all.
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 28 Jun 2012 Link to this post

    Hi,

    I am afradi that RadDataFilter does not support such customization.

    Regards,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Shankar
    Shankar avatar
    26 posts
    Member since:
    Dec 2011

    Posted 08 Aug 2012 Link to this post

    @XamlmaX, did you figure out a way (or a workaround) for your problem? Please let me know. I am looking for a similar functionality

    Thanks,
  5. Pete
    Pete avatar
    67 posts
    Member since:
    Sep 2012

    Posted 08 Aug 2012 Link to this post

    Yes, I think so - although I haven't implemented it yet so i can't be 100% sure.

    See my response to a related problem here: http://www.telerik.com/community/forums/silverlight/data-filter/readonly-filter-descriptor.aspx
    If you look in the xaml for "PART_SimpleFilterOperatorCombobox" you will see this is the combobox in the RadDataFilter. You should be able to replace this with a treeview (as long as you give it the same name) and it should work.

    Hope this helps.
  6. Shankar
    Shankar avatar
    26 posts
    Member since:
    Dec 2011

    Posted 08 Aug 2012 Link to this post

    So, this solution requires me to change the XAML in the Telerik API and recompile the binaries?

    If I change the xaml by making the PART_SimpleFilterOperatorCombobox a Treeview, it should not affect any other place right?
  7. Pete
    Pete avatar
    67 posts
    Member since:
    Sep 2012

    Posted 08 Aug 2012 Link to this post

    Only where you have a RadDataFilter (if you choose not to put a key on your style), or only the RadDataFilters where you apply your named style
  8. Shankar
    Shankar avatar
    26 posts
    Member since:
    Dec 2011

    Posted 08 Aug 2012 Link to this post

    Thanks! that would help. However please let me know one more thing.

    Is there a way we can define this style attribute in our xaml and when we define the RadDataFilter (in our xaml) we override the default style with our defined style (where I want to change the RadComboBox style property). This way we need not recompile the Telerik API library binary (Telerik.Windows.Controls.Data.dll)

    Please let me know if that is a possibility. Once again, thanks for the information.
  9. Pete
    Pete avatar
    67 posts
    Member since:
    Sep 2012

    Posted 09 Aug 2012 Link to this post

    Yes. Please see the link I posted to my other issue.
    Open Telerik.Windows.Controls.Data.dll in notepad and search for the RadDataFilter .This will give you the template for the control.
    Extract that into a resource dictionary and use it as you would any other template in Silverlight (i.e. add a key if you want to use it in specific circumstances, or remove the key if you want it to apply to all instances of that particular TargetType). You do not need to recompile the Telerik libraries as your style/template will override the default.
  10. Shankar
    Shankar avatar
    26 posts
    Member since:
    Dec 2011

    Posted 13 Aug 2012 Link to this post

    @XamlmaX,

    Thank you for the solution, this worked, however I am now having a problem in setting the ItemSource and SelectedItem property for the control.

    This is due to the reason that I am using a Custom Control instead of the RadComboBox for the members dropdown

    Could you please throw some light on this?
  11. Pete
    Pete avatar
    67 posts
    Member since:
    Sep 2012
  12. Shankar
    Shankar avatar
    26 posts
    Member since:
    Dec 2011

    Posted 16 Aug 2012 Link to this post

    Thank you so much Xamlmax!! This works perfectly..
  13. Pete
    Pete avatar
    67 posts
    Member since:
    Sep 2012

    Posted 21 Jan 2013 Link to this post

    Hi Shankar
    Did you get this working properly in the end? I am trying this myself now but the DataFilter seems to be ignoring my customized template.
  14. Shankar
    Shankar avatar
    26 posts
    Member since:
    Dec 2011

    Posted 21 Jan 2013 Link to this post

    Hi Pete, yes I got it to work, and I am defining it in the following way:

    <local:ColumnPickerControl x:Name="PART_SimpleFilterMemberComboBox" telerik:StyleManager.Theme="{StaticResource Theme}"
    Margin="0,0,3,0" MinWidth="100" VerticalAlignment="Center"
    DataFilter="{Binding x:ElementName=RadDataFilter, IsAsync=True}"
    RadSimpleFilterVM="{Binding SimpleFilter, Mode=OneWay, IsAsync=True}" />

    Hope this helps..
  15. Pete
    Pete avatar
    67 posts
    Member since:
    Sep 2012

    Posted 22 Jan 2013 Link to this post

    Finally got it working - it's not very straight forward though.

    The problem is that the ItemPropertyDefinitions are converted at runtime into ItemPropertyDefinitionViewModels and added to a SimpleFilterViewModel for the FilterControl (inside the RadDataFilter control).

    The SimpleFilter view model has a SelectedMember property and an AvailableMembers collection. When you set the SelectedMember property it must be an item in the AvailableMembers list.

    This means that if you inherit from ItemPropertyDefinition and add a Children collection (as I have), at runtime the items in Children are not converted into ItemPropertyDefinitionViewModels and not added to the AvailableMembers list.

    To get around this I have to add all the child items a ItemPropertyDefinitions collection on the RadDataFilter and filter them out of the itemsource for the treeview using a converter. This also means that the binding to SelectedMember will not work as any child item in the tree will not be available in the AvailableMembers list. To overcome this I have to have two behaviors - one for when the dropdownbutton is opened (to set the selected item), and another for the TreeView when the selection is changed (to set the SimpleFilter.SelectedMember).

    It's pretty complicated really for something that seems like it should be simple. Hopefully this explanation will help someone else from going through the full process that I have to try and solve this problem!
Back to Top
DevCraft banner