RadGridView Grouping on collection

4 posts, 0 answers
  1. Ali
    Ali avatar
    1 posts
    Member since:
    May 2016

    Posted 22 May 2016 Link to this post


    I've been using telerik grids for a long time now and been facing an issue lately or lack of my knowledge when it comes to grouping by the collection (not a property). Here's my scenario, I'm showing list of employees in the grid, each employee can have multiple roles and I want to group the data by roles and each group will list all the employees under that role. 


    I am binding my employees collection to a collectionviewsource and adding the groupdescriptions (collection of employee roles) but it ain't showing anything. I wanted to ask if it is possible to group by the collection in such a scenario? Thank you team telerik     

  2. Dilyan Traykov
    Dilyan Traykov avatar
    1171 posts

    Posted 25 May 2016 Link to this post

    Hello Ali,

    You could use a Generic GroupDescriptor in order to achieve the desired behavior.

    Please also have a look at the "Custom Grouping" demo from our UI for WPF Demos and the "Sort Group by Different Property" demo from our SDK Samples Browser if you have not done so already.

    I hope you find this helpful.

    Dilyan Traykov
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. Sam
    Sam avatar
    1 posts
    Member since:
    Aug 2016

    Posted 25 Nov 2016 in reply to Dilyan Traykov Link to this post

    Did you find a way to do this Ali?


    Dilyan I don't think your examples are helpful in this case. Everything you linked to operates on the assumption that a single row will produce a SINGLE grouping key. In this case, each row may belong to multiple groups. See my attached example screen shot. If we were to group by "Employee Roles", the group "Coder" should have employee IDs 2 and 3, and the group "Pleb" would have employee IDs 2 (again) and 1 etc.


    I suspect internally something like this is happening when using the generic group descriptor:


    which means it's not possible to have a single row entity appearing in more than 1 group.

    Any advice would be appreciated.




  4. Dilyan Traykov
    Dilyan Traykov avatar
    1171 posts

    Posted 28 Nov 2016 Link to this post

    Hello Sam,

    Yes, I'm afraid that with the current implementation of the grouping functionality, there is no easy way to achieve the desired behavior. You could modify the ItemsSource of the control to contain duplicate values of the items so that they are displayed once for each group but that will not be an elegant solution.

    Dilyan Traykov
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Back to Top