We have a grid several hierarchies deep and the moment a rowdetail(and thus grid) scrolls out of view, UnloadingRowDetails fires and the details template gets disposed causing the child grid and it's data to dispose.
Is there a way to stop the UnloadingRowDetails event from firing and just leaving the row expanded?
Regards
Renier
8 Answers, 1 is accepted
The only way to disable the unloading of RowDetails is to turn off the row virtualization feature by setting EnableRowVirtualization to false. Will that be okay for your scenario?
Kind regards,
Maya
the Telerik team
I have the same issue and was very pleased to see this thread. Turning off the RowVirtualization works fine, but ends up with a very poor performance. Is there another possibility, perhaps interrupting the UnloadRowDetails event?
Thanks, Jonas
Generally, once a row is recycled, its RowDetails will be too. What you may try to do is to use a hierarchy template instead as the child elements in this case would be cached.
Maya
the Telerik team
I'm just trying to use the HierarchyChildTemplate instead the RowDetails. Inside the DataTemplate is a custom UserControl which I filled in a LoadingRowDetails event handler, when i used the RowDetails.
I did not find a similar handler for the HierarchyTemplate. Furthermore I call the ExpandAllHierarchyItems() and CollapseAllHierarchyItems() to initalize the views.
I'm not sure, if this is the best attempt to put data into the HierarchyChild. What would be the best practice in this case?
Thank you in advance,
Jonas
Basically, the grid loads the data for the child grids on demand. However, you may take a look at this blog post and this forum thread for additional reference.
As far as the corresponding events are concerned, on opening the parent row the RowIsExpandedChanging and RowIsExpandedChanged events will be fired.
Maya
the Telerik team
<
DataTemplate
x:Key
=
"DetailGridRow"
>
<
PVUIControls:myUserControl
></
PVUIControls:myUserControl
>
</
DataTemplate
>
When using the RowDetails i got the myUserControl object in the LoadingRowDetails handler from GridViewRowDetailsEventArgs.DetailsElement.
Now, the RowIsExpandedChanged handler is triggered right, but i can't find HierarchyChild for each row in the event args. Is there any possibilty to get myUserControl from this handler method?
Generally, the element in the hierarchy child template will not be initialized until being expanded. May you provide a bit more details about the scenario you want to accomplish ?
Maya
the Telerik team
Thank you!