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

Hide rows under group row

1 Answer 23 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 06 Dec 2011, 03:07 PM
Hi, i have a scenario where i need to collapse the rows under a group row making it look like there is a group without any items underneath it.

I have set AutoExpandGroups to true

I created a behavior that listens to row loaded sets row visbility to collapsed in my business case but it leaves this white space around when i collapse and expand my group row.

I then modified my behavior to walk up the tree to find the first instance of GridViewVirtualizingPanel and set its visibility to collapsed.  What happens here is that i still have the white space, but when i collapse and then expand the white space is gone.  I have no idea why the white space wants to be there the first time but after a collapse and expand it goes away.

I was able to fix this by putting my code to set the GridViewVirtualizing panels visibility state in a Dispatcher.BeginInvoke call and the white space goes away and never comes back.  The problem with this solution though is that the grid is very jumpy because for each row loaded it has a dispatcher call so they execute one at a time.

I have to use row loaded for this due to virtualization so that when a row gets re-used with a different datacontext it properly makes the panel visibile again.

Is there any way that i can do this better?

EDIT:

It would also help alot if there was a way to know when a group row itself is loaded.  Is there any way to do that?

1 Answer, 1 is accepted

Sort by
0
Jason
Top achievements
Rank 1
answered on 06 Dec 2011, 05:18 PM
I ended up going a different route.  Hiding the rows wont work with virtualization due to the fact that rowloaded never occurs again to make it visible when the row is re-used.

Instead i used GroupRowIsExpandedChanging to keep them from being expanded and when the items source changes i dispatcher.begininvoke to go through the groups and set their collapsed state
Tags
GridView
Asked by
Jason
Top achievements
Rank 1
Answers by
Jason
Top achievements
Rank 1
Share this question
or