Virtualization + Grouping. Expanding all is not possible?

7 posts, 2 answers
  1. Alexander
    Alexander avatar
    11 posts
    Member since:
    Aug 2011

    Posted 27 Mar 2012 Link to this post

    Hi, guys.

    Here is what we have:
    1. We're loading ~ 5-10 thousands of items into grid which has RowVirtualization enabled and has some groups.
    2. All groups are collapsed by default and the data is displayed fast.
    3. There is also a button on the form which is used to expand all grid groups with the following code:
    //This is the method of of RadGridView child class we have in our project
          private void ExpandGroupByIndentLevel(int level)
          {
             var groupRows = this.ChildrenOfType<GridViewGroupRow>().Where(r => r.Level == level && !r.IsExpanded);
             foreach (var groupRow in groupRows)
             {            
                groupRow.IsExpanded = true;
             }
          }

    So..this code doesn't work when RowVirtualization is enabled. In this case only visible rows are expanded.
    And we can't disable Row Virtualization because while expand all works there, it takes forever to display the data in that case.

    So, how should we manage this?

    Thanks in advance.
    Alexander.
  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 27 Mar 2012 Link to this post

    Hi,

     You should avoid working directly with UI elements in both WPF and Silverlight at all costs! Please use ExpandAllGroups() method or AutoExpandGroups property instead. 

    Greetings,
    Vlad
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. Alexander
    Alexander avatar
    11 posts
    Member since:
    Aug 2011

    Posted 27 Mar 2012 Link to this post

    Hi, Vlad

    Thanks for you answer. But how can we  trigger expanding only specific level of grouping?
    As I understand the solutions you suggest will expand all the group levels we have.
  4. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 27 Mar 2012 Link to this post

    Hi,

    With Silverlight 5 you can have bindings in style setter which in this case can help you to create custom style for GridViewGroupRow with conditional IsExpanded Binding (depending on level). 

    Greetings,
    Vlad
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  5. Alexander
    Alexander avatar
    11 posts
    Member since:
    Aug 2011

    Posted 27 Mar 2012 Link to this post

    Thank you, Vlad.

    Do I understand it right, that there is no solution for SL4?

    Cheers,
    Alexander.
  6. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 27 Mar 2012 Link to this post

    Hello,

     With Silverlight 4 you can try GroupRowStyleSelector to achieve your goal. 

    All the best,
    Vlad
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  7. Alexander
    Alexander avatar
    11 posts
    Member since:
    Aug 2011

    Posted 27 Mar 2012 Link to this post

    Many thanks for your help, Vlad.

    I'll try to utilize that class.

    Cheers,
    Alexander.
Back to Top