Completed
Last Updated: 09 Feb 2022 07:42 by ADMIN
Scott
Created on: 01 Aug 2016 21:37
Category: TreeListView
Type: Bug Report
3
TreeListView: IsExpandedBinding doesn't update until item is visible
Per the thread at "http://www.telerik.com/forums/isexpandablebinding-requires-user-interaction-with-control-to-take-effect" I have modified the IsExpandedRowBinding sample to recreate the problem. I modified the button to expand and collapse the first row. To reproduce the problem:

1. Expand the first row.
2. Scroll down so the first row is not visible but it's children are visible.
3. Press the button. The expected behavior is the first row should collapse but nothing happens.
4. Scroll up so the first row is visible. The first row collapses.
6 comments
ADMIN
Ivan Petrov
Posted on: 09 Feb 2022 07:42

When expanding/collapsing items through code developers should use the code provided in this help article - Expand and Collapse Items Programmatically.

Regards,
Ivan Petrov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

ADMIN
Stefan
Posted on: 10 Oct 2016 13:46
Hello Scott,

I am happy that you've found a workaround that manages to suit your needs.

Best Regards,
Stefan
Scott
Posted on: 07 Sep 2016 11:40
Thanks for the information. After some testing on our end the best work around I have come up with so far is to have a thread that forces the tree to refresh every few seconds. 

I was initially going with the approach of only forcing a refresh when I knew something had changed but that didn't work 100% of the time.
ADMIN
Stefan
Posted on: 19 Aug 2016 10:13
Hello Scott,

A similar approach for a workaround would be to call the Rebind method of RadTreeListView. Note, that both workarounds will work only when the first child node of an expanded parent is visible. If the user scrolls down so that the first child is not visible, the parent node would not be collapsed. 

As stated in my previous reply, the issue is due to the virtualization functionality of the control. I am afraid, that I cannot provide a workaround that will be working as expected in all scenarios.

All the best,
Stefan
Scott
Posted on: 16 Aug 2016 12:01
Is there a recommended workaround for this? I have been using the following two lines when my IsExpanded property is changed:

TreeListView.Items.Refresh();
TreeListView.UpdateLayout();

This does force the TreeListView to update but I have also seen some weird side effects by using this workaround. For example, the TreeListView will occasionally collapse all of the items when these two lines are called.
ADMIN
Stefan
Posted on: 04 Aug 2016 14:27
Hi Scott,

Thank you for your feedback and the effort to modify the sample application.

Indeed, this seems to be an issue on our end. It is reproduced due to the virtualization mechanism of the control. When a given row gets out of the viewport, it is being unloaded. Thus, it cannot be collapsed/expanded. Respectively, when it gets back in the viewport it is being reloaded and its IsExpandedBinding is evaluated. We will research the possibility for handling this scenario. Please note, however, that since the virtualization mechanism is involved, we cannot commit ourselves that a stable fix for this issue can be implemented.

Thanks in advance for your understanding.

Best Regards,
Stefan