Hi,
I am using RadTreeView to display the hierarchy such as folders/subfolders and items within them. I have implemented template and style selectors according to the treeview item type But in case that I have a lot of folders (100+) with items in it (10+ items per folder) it take to much time to bind that on UI.
NOTE: folders are expanded by default.
I checked my data access layer and results are retrieved from the database in a decent time, so seems to me that the issue is just on UI side. I checked whether virtualization is working,check the live tree view and saw that there is ~20 folders loaded, even though, according to the current window(container) size there can be visible just 2 expanded folders with their items on the viewable area, so I was suspecting that this could be a cause of some delays because event virtualization is working, tree view loads much more elements than it could display.
Is there any way to handle this?
Also, whenever UI is refreshed I can see in my log exception like:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'ListBoxItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')
I figured out that it throwing this exception takes some amount of time. I checked the styles and tried to update all suspicious places in code but still getting the same error, so maybe I do not understand the real meaning of that exception. Any thoughts on this error?
I am using RadTreeView to display the hierarchy such as folders/subfolders and items within them. I have implemented template and style selectors according to the treeview item type But in case that I have a lot of folders (100+) with items in it (10+ items per folder) it take to much time to bind that on UI.
NOTE: folders are expanded by default.
I checked my data access layer and results are retrieved from the database in a decent time, so seems to me that the issue is just on UI side. I checked whether virtualization is working,check the live tree view and saw that there is ~20 folders loaded, even though, according to the current window(container) size there can be visible just 2 expanded folders with their items on the viewable area, so I was suspecting that this could be a cause of some delays because event virtualization is working, tree view loads much more elements than it could display.
Is there any way to handle this?
Also, whenever UI is refreshed I can see in my log exception like:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'ListBoxItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')
I figured out that it throwing this exception takes some amount of time. I checked the styles and tried to update all suspicious places in code but still getting the same error, so maybe I do not understand the real meaning of that exception. Any thoughts on this error?
10 Answers, 1 is accepted
0
Ranko
Top achievements
Rank 1
answered on 28 Aug 2018, 07:11 PM
Also, my performance profiler tool sees the UI freeze 7 seconds long where method
Telerik.Windows.Controls.TreeView.TreeViewPanel.MeasureOverride(Size) execution takes ~5 seconds
Telerik.Windows.Controls.TreeView.TreeViewPanel.MeasureOverride(Size) execution takes ~5 seconds
0
Hello Ranko,
Thank you for the detailed description.
Firstly, can you please verify whether the IsVirtualizing property of RadTreeView on your end is set to True? Also, depending on the specific requirement you can set the VirtualizationMode to Recycling or Hierarchical. More information on this matter can be found in the UI Virtualization topic. Please also note, that RadTreeView supports Load on Demand from which you can benefit.
As for the logged error you are experiencing, it is a binding failure. Please, take a look at the How To Debug Data Binding Issues in WPF blog post, as this is a common topic for the framework. Of course, there are various other resources on it that can be found over the net.
I hope this helps.
Regards,
Stefan
Progress Telerik
Thank you for the detailed description.
Firstly, can you please verify whether the IsVirtualizing property of RadTreeView on your end is set to True? Also, depending on the specific requirement you can set the VirtualizationMode to Recycling or Hierarchical. More information on this matter can be found in the UI Virtualization topic. Please also note, that RadTreeView supports Load on Demand from which you can benefit.
As for the logged error you are experiencing, it is a binding failure. Please, take a look at the How To Debug Data Binding Issues in WPF blog post, as this is a common topic for the framework. Of course, there are various other resources on it that can be found over the net.
I hope this helps.
Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ranko
Top achievements
Rank 1
answered on 14 Sep 2018, 04:17 PM
We are doing everything that you suggested already. Load on demand is not good solution for us since all tree nodes are expanded by default. One more detail, when three view item is expanded, the content of that tree view item is list view with items with certain height, that was the only way to enable the virtualization of the items within the nodes. Maybe you have some advice on that, since we couldn't make virtualization of the elements within three view item work in other way?
But still, Recycling or Hierarchical virtualization mode is loading more folders than it should actually be shown on ui in expanded state
But still, Recycling or Hierarchical virtualization mode is loading more folders than it should actually be shown on ui in expanded state
0
Ranko
Top achievements
Rank 1
answered on 14 Sep 2018, 04:27 PM
It seems like treeview is calcualting the number of the treeview items that could be visible in viewable area according to the height of the header of the node, for example, in my case, there could be shown 23 collapsed treeview items in my window.
Since default state is expanded, when I open the window, I can see 2 expanded treeview items , but in a live tree view in Visual Studio I am seeing that 23 treeview items are loaded.
Since default state is expanded, when I open the window, I can see 2 expanded treeview items , but in a live tree view in Visual Studio I am seeing that 23 treeview items are loaded.
0
Hello Ranko,
It is a bit strange that with the Hierarchical mode the virtualization is not working for the expanded nodes. Can you please clarify how you have verified that the items are loaded? The easiest approach to check whether the virtualization is working or not is to hook up to the ItemPrepared event of the control. If the virtualization is not working, the event will be fired for all items. From the currently provided information I guess that the virtualization of the control is somehow disabled. Can you please clarify whether the control is not placed within a container that measures it with infinity? In such case the control cannot perform the measuring calculations which results in a non working virtualization.
Regards,
Stefan
Progress Telerik
It is a bit strange that with the Hierarchical mode the virtualization is not working for the expanded nodes. Can you please clarify how you have verified that the items are loaded? The easiest approach to check whether the virtualization is working or not is to hook up to the ItemPrepared event of the control. If the virtualization is not working, the event will be fired for all items. From the currently provided information I guess that the virtualization of the control is somehow disabled. Can you please clarify whether the control is not placed within a container that measures it with infinity? In such case the control cannot perform the measuring calculations which results in a non working virtualization.
Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ranko
Top achievements
Rank 1
answered on 11 Oct 2018, 12:14 PM
Hi,
IsVirtualizing is set to true.
VirtualizationMode set to Hierarchical
Nodes are expanded by default.
I can see only two nodes on the view area.
Visual Three in VS shows as on attached screenshot.
OnItemPrepared event fired for same amount of items as it is on attached screenshot + amount of subnodes within root nodes shown on screenshots (in my case each root node, has one subnode that is actuall ListView of certain items.
IsVirtualizing is set to true.
VirtualizationMode set to Hierarchical
Nodes are expanded by default.
I can see only two nodes on the view area.
Visual Three in VS shows as on attached screenshot.
OnItemPrepared event fired for same amount of items as it is on attached screenshot + amount of subnodes within root nodes shown on screenshots (in my case each root node, has one subnode that is actuall ListView of certain items.
0
Ranko
Top achievements
Rank 1
answered on 15 Oct 2018, 09:40 AM
Hi,
any thoughts on details above? This is very important and high priority issue for us and we need to find a solution and understand what is actually an issue.
Thanks
any thoughts on details above? This is very important and high priority issue for us and we need to find a solution and understand what is actually an issue.
Thanks
0
Hello Ranko,
Thank you for the update and the provided image.
Based on the provided information I assume that the UI virtualization is disabled. Please note, that setting the IsVirtualizing property to True is irrelevant in cases when RadTreeView is placed within a control that measures it with infinity. I can confirm that in such setup the virtualization would not be able to work. Such containers are StackPanel and ScrollViewer, for example. Can you please verify this?
If the control is not measured with infinity, may I kindly ask you to demonstrate the exact setup you are using in a sample application, open a new support thread and attach the demo project in it. Thus, we will be able to debug the project on our end and assist you further.
Regards,
Stefan
Progress Telerik
Thank you for the update and the provided image.
Based on the provided information I assume that the UI virtualization is disabled. Please note, that setting the IsVirtualizing property to True is irrelevant in cases when RadTreeView is placed within a control that measures it with infinity. I can confirm that in such setup the virtualization would not be able to work. Such containers are StackPanel and ScrollViewer, for example. Can you please verify this?
If the control is not measured with infinity, may I kindly ask you to demonstrate the exact setup you are using in a sample application, open a new support thread and attach the demo project in it. Thus, we will be able to debug the project on our end and assist you further.
Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ranko
Top achievements
Rank 1
answered on 16 Oct 2018, 10:22 AM
Hi, thanks for your response.
I can confirm that RadTreeView is not placed within StackPanel or ScrollViewer. It is within the Grid, actually within grid Row with Height="*". Anyway, I will try to isolate my code and make an example project with current configuration so you can review.
Thanks.
I can confirm that RadTreeView is not placed within StackPanel or ScrollViewer. It is within the Grid, actually within grid Row with Height="*". Anyway, I will try to isolate my code and make an example project with current configuration so you can review.
Thanks.
0
Hi Ranko,
Please, take your time to prepare the demo project. I will be happy to assist you further.
Regards,
Stefan
Progress Telerik
Please, take your time to prepare the demo project. I will be happy to assist you further.
Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.