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

RadTreeView default IsExpanded not working in combination with LoadOnDemand in combination with IsVirtualized

5 Answers 47 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kristof Van Cauwenberghe
Top achievements
Rank 1
Kristof Van Cauwenberghe asked on 08 Jun 2016, 02:16 PM

We have been using the RadTreeView with IsVirtualizing=False and IsLoadOnDemand=False for several years now.

In the creation of RadTreeViewItems we specify if the node should be expanded or not. (Depending on the current user, the node is expanded).

 

But because some clients are getting very large trees, we are looking for a solution to speed up the tree.

I found the telerik example "TreeViewPerformance", and I managed to get it working in our application. With a very nice speed improvement.

The only issue is that the IsExpand property does not work.

I create a new RadTreeViewItem. And I set following ".IsExpanded = bIsExpanded".

 

I found a workaround for this. In the "Loaded" event, to set this property again.

With this enabled, the tree expands as expected.

 

Is this a bug that the expand does not work as it does when not using virtualisation and loadondemand?

Or how can I solve this without the extra event.

Attachment contains the UserControl with example that shows the problem.

 

I'm using the latest dll's. Silverlight_2016_Q2\2016_2_503\

5 Answers, 1 is accepted

Sort by
0
Kristof Van Cauwenberghe
Top achievements
Rank 1
answered on 08 Jun 2016, 02:17 PM
Attachment: https://www.dropbox.com/s/x8d7ti6aio4gx0p/SilverlightTreeViewPerformance.zip?dl=0
0
Accepted
Dinko
Telerik team
answered on 09 Jun 2016, 11:26 AM
Hello Kristof Van Cauwenberghe,

The described behavior is expected. Basically, there is nothing to expand because the nodes still not have its Items collection populate. That is why the nodes are not expanded. You can populate the tree view items in the GetNextTreeItem() method so you can observe the describe behavior.
for (int i = 0; i < 5; i++)
{
    oItem.Items.Add(new RadTreeViewItem() { Header= GetNextNodeName()});
}
You can take a look at the Load On Demand help article in our documentation. 

After I have examined your project I noticed that you're populating the RadTreeView with RadTreeViewItems. However, when using the UIVirtualization feature of the control, it's important to note that it is designed to work within a data-bound RadTreeView. This means that it will only work correctly, if the RadTreeView.ItemsSource collection is populated with business items. You can read more about the virtualization in the RadTreeView in the UI Virtualization help article in our documentation.
Regards,
Dinko
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Kristof Van Cauwenberghe
Top achievements
Rank 1
answered on 09 Jun 2016, 05:22 PM

Hi,

We know we should refactor our code to work with a data-bound collection. But before we do that, I would like to know following.

Lets take the TreeViewPerformance example (http://demos.telerik.com/silverlight/#TreeView/Performance)

 

Is it possible, with virtualization enabled, to expand to a specific node.

For example that on load, following automatically expands "Secret Team\Fixes Team\Environent Group"

We used to set the RadTreeViewItems to IsExpanded=true. But how can we do this when a collection is bound.

 

0
Dinko
Telerik team
answered on 14 Jun 2016, 06:47 AM
Hello Kristof Van Cauwenberghe,

You can create a boolean property in your business object and bind it to the IsExpanded property of the RadTreeViewItems via style. We have Binding the IsExpanded property section in our help documentation where this approach is further described. 

Let us know if this works for you or you have any other questions.

Regards,
Dinko
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Kristof Van Cauwenberghe
Top achievements
Rank 1
answered on 16 Jun 2016, 07:37 AM

Hi,

I managed to get our tree fully working via a data-bound collection.

At this moment I do not have any issues. So this case can be closed.

Thanks

Tags
TreeView
Asked by
Kristof Van Cauwenberghe
Top achievements
Rank 1
Answers by
Kristof Van Cauwenberghe
Top achievements
Rank 1
Dinko
Telerik team
Share this question
or