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

IsVirtualizing issue

6 Answers 122 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
SWAYAM KAR
Top achievements
Rank 1
SWAYAM KAR asked on 24 Mar 2010, 07:26 PM
I am using RadTreeControl to populate a large number of items.Nodes can contain as many as 10000 child nodes. I was hoping the use of UI virtualization is going to speed up the time required to expand/collapse nodes. The behavior I am seeing is  whenever I expand/collapse nodes, some items show up as blank text and node default images cease showing up.

Thanks,
Swayam

6 Answers, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 24 Mar 2010, 08:57 PM
Hi SWAYAM KAR,

Indeed  the UI Virtualization should speed things up.

If the TreeView is given enough space to expand infinitely virtualization will not kick in. This may happen if the TreeView is placed in a ScrollViewer or a StackPanel (they do not limit the size of their children).

If you refer to speed of the expand animation it can be turned like so:

// Turn off all animations:
AnimationManager.IsGlobalAnimationEnabled = false;
  
// Speed it up x 2
AnimationManager.AnimationSpeedRatio = 2.0;

Can you send us a screenshot of the blank TreeViewItems or best - a project where this is reproduced?

Sincerely yours,
Miroslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
SWAYAM KAR
Top achievements
Rank 1
answered on 24 Mar 2010, 09:08 PM
Hello Miroslav,

Thanks for the prompt response. If I use virtualization, when I expand a tree node for the first time the items show up. If I collapse them all and expand back, the items go missing. Another issue with virtualization is that, default images for the nodes fon't show up. I have attached two screenshots displaying the behavior.

Note: I am not using databinding to populate the tree control and adding items while iterating thorugh a flat data structure.
0
Miroslav
Telerik team
answered on 24 Mar 2010, 09:20 PM
Hello SWAYAM KAR,

Thank you for the screens and the clarification.

Do you mean that you are creating the TreeViewItems in code and then building the hierarchy yourself?

If this is the case then this may be the reason for the strange behavior.

UI Virtualization means that the TreeView will create UI containers (TreeViewItems) only for the visible items and it will reuse these containers when needed.

If you create the TreeViewItems yourself then a large number of items will already be created and there is little that can be done to improve the performance.

In this case I can suggest databinding the TreeView and using an <Image /> in the data template instead of a setting the DefaultImageSrc.

Would this be an option for you?

Sincerely yours,
Miroslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
SWAYAM KAR
Top achievements
Rank 1
answered on 24 Mar 2010, 09:37 PM
Reverting back to databinding will mean converting the current flat structure into a heriarchical one which is an option I am willing to take if nothing else works out.

I understand that databinding facilitates UI virtualization in a way that it can work of off a datastore and create the only visible parts of the UI elements while recycling the available containers. I was hoping that while I am creating new RadTreeViewItems and populating them with data, under the hood it creates a data structure that contains just the data (Like a data source) and metadata and that the actual UI elements are not created(reused) till the time they are displayed.

In other words, when I create new instances of the UI items, it creates instances of a lightweight object instead( a name-value pair may be) which contains the display data and the properties for the UI element.

Thanks,
Swayam
0
Miroslav
Telerik team
answered on 24 Mar 2010, 11:58 PM
Hi SWAYAM KAR,

You start by saying: Reverting back to databinding...

Do you mean that you used databinding but decided against it at some point? Can you tell us what was the reason for this decision if this is what happened.

I am attaching a project that contains a ValueConverter that can take a flat list of items and build the hierarchy on the fly. It requires little or no changes to the ViewModel. The converter must be initialized with expressions that specify the Id and ParentId properties of the ViewModel, you can have a look at the example in the solution.

Hopefully this will help you build the hierarchy faster.

Please note that the converter builds the hierachy eagerly.

The TreeViewItems are in fact the actual visual elements that show up in the TreeView and will slow down the application if there are a lot of them.

All the best,
Miroslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
SWAYAM KAR
Top achievements
Rank 1
answered on 25 Mar 2010, 08:10 PM
Well..not exactly. I use databinding in other parts of the project and I meant that. Sorry about the confusion. I will give heriarchy converter a try and let you know. Appreciate your help. 
Tags
TreeView
Asked by
SWAYAM KAR
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
SWAYAM KAR
Top achievements
Rank 1
Share this question
or