So I have a RadGridView, with 10 items in it... CollapseAllHierarchyItems only seems to collapse half of them. I tried running a loop and invoking CollapseHierarchyItem on each member of Items, and that only does about half of them as well.
If I run this loop twice, going back to the main thread in between, it works. Any ideas?
If I run this loop twice, going back to the main thread in between, it works. Any ideas?
6 Answers, 1 is accepted
0
Jerome
Top achievements
Rank 1
answered on 01 Mar 2011, 05:51 PM
It seems like it only Collapses the first 5 items. Is there some sort of limit of some weird sort?
0
Hello Jerome,
Maya
the Telerik team
Generally, there is no limitation for the number of items that can be expanded. I am sending you the sample project I used for testing the scenario you described. Please take a look at it and let me know in case of any discrepancies.
Maya
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Jerome
Top achievements
Rank 1
answered on 01 Mar 2011, 06:44 PM
Okay. I've figured my issue out. I had a Setter that was setting IsExpanded on rows to True, because I want the default state of new rows to be expanded. The problem is, this setter is being run shortly after CollapseAll, but only on some of the rows, so they are being reexpanded. No idea why only SOME rows are having this happen, and not all of them.
Regardless, I tried to remove the Setter, and instead use an EventSetter on the row Loaded event, in which I set IsExpanded for one row at a time. Just like the previous Setter I tried, this event is being raised by only some of the rows, and so they're being reexpanded.
So I'm still trying to figure out a proper solution to this. I want new rows to be Expanded by default, but I need to be able to collapse them all with a button.
The Loaded event being raised after CollapseAll doesn't seem reasonable to me. It seems spurious. Is the GridView like, recreating rows internally during a collapse, and thus having Loaded raised on those new ones? Or is it just an accidental invocation of something?
Either way, I'm trying to find an alternative solution to this.
Regardless, I tried to remove the Setter, and instead use an EventSetter on the row Loaded event, in which I set IsExpanded for one row at a time. Just like the previous Setter I tried, this event is being raised by only some of the rows, and so they're being reexpanded.
So I'm still trying to figure out a proper solution to this. I want new rows to be Expanded by default, but I need to be able to collapse them all with a button.
The Loaded event being raised after CollapseAll doesn't seem reasonable to me. It seems spurious. Is the GridView like, recreating rows internally during a collapse, and thus having Loaded raised on those new ones? Or is it just an accidental invocation of something?
Either way, I'm trying to find an alternative solution to this.
0
Jerome
Top achievements
Rank 1
answered on 01 Mar 2011, 07:00 PM
You can reproduce my issue by adding this to the top-level RadGridView in your test case:
<telerik:RadGridView.RowStyle> <Style TargetType="telerik:GridViewRow"> <Setter Property="IsExpanded" Value="True" /> </Style> </telerik:RadGridView.RowStyle>
0
Jerome
Top achievements
Rank 1
answered on 01 Mar 2011, 07:13 PM
Loaded and the Setter are being raised on rows that are currently outside of the viewable area of the GridView. So I'm guessing they are being recreated. Virtualized? Hmm.
0
Jerome
Top achievements
Rank 1
answered on 01 Mar 2011, 07:15 PM
Yup. If I disable row virtualization, the problem goes away. That's good enough for now, I guess.