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

CheckState and IsVirtualizing Problem

11 Answers 234 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Tracy
Top achievements
Rank 1
Tracy asked on 12 Jan 2011, 10:01 PM
When trying to use IsVirtualizing we are running into an issue with checkboxes not in the initial view are set incorrectly on data load. We are not binding to IsChecked property but are binding to the CheckState property.

The following is used to define the RadTreeViewItems:

<Style TargetType="{x:Type telerikNavigation:RadTreeViewItem}">
    <Setter Property="CheckState" Value="{Binding IsCheckedState, Mode=TwoWay}" />
    <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
</Style>

The RadTreeView includes the virtualization settings:

IsVirtualizing="True" 
telerikTreeView:TreeViewPanel.VirtualizationMode="Hierarchical">

Does it look like the xaml is wrong?  If not, is there a work-around or a fix for this?

Without the virtualization, the RadTreeView is unacceptably slow on loading a list of just 7500 root level items.

Thanks,

T.

11 Answers, 1 is accepted

Sort by
0
Tracy
Top achievements
Rank 1
answered on 14 Jan 2011, 12:15 AM
After additional research the main problem is that programmatic changes to a virtualized RadTreeViewItem checkbox CheckState are not triggering the Check/Uncheck events that are tied to the RadTreeView.  Only the ones currently in the view are triggering the event properly.

T.
0
Tracy
Top achievements
Rank 1
answered on 14 Jan 2011, 04:29 PM
Since there doesn't seem to be a solution to the Check/Unchecked event not firing for virtualized items -- perhaps I can catch the virtualized items when they come into view (by scrolling) so I can make sure the children checkboxes are set appropriately.  Is there an event that gets triggered when a virtualized RadTreeViewItem comes into the current view?  If there is -- please include a code snippet on how to setup the event.

Thanks in advance.

Tracy.
0
Petar Mladenov
Telerik team
answered on 17 Jan 2011, 04:12 PM
Hello Tracy,

This is a known issue and you can vote for it here. The good news is the elegant workaround that uses Converter to switch from bool? or bool to ToggleState. you can examine it in the attached solution and let me know if it fits in your scenario.

Regards,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Tracy
Top achievements
Rank 1
answered on 17 Jan 2011, 04:30 PM
Thanks for responding.

We are using both CheckState and IsChecked in conjunction together, so that doesn't seem to be the issue.

In the example you sent you are only dealing with one level of items in the treeview which we are not having a problem keeping the root level items in the correct state. We have two levels and it is the child level which we are having issues with keeping the correct state. The TreeView's Checked/Unchecked event allowed us to keep the children in synch with the parents - but virtualization has broken that ability.  We are dealing with upwards of 7500 root level items with 1 to 3 child items each, so we are using virtualization. I don't see that addressed in the example. 

I really don't want to resort to turning off virtualization since it causes "out of memory" errors and is incredibly cpu intensive when loading the treeview.

Tracy
0
Tracy
Top achievements
Rank 1
answered on 17 Jan 2011, 10:10 PM
When using VirtualizationMode="Hierarchical" the event Loaded gets triggered when scrolling down through the virtualized items.

When using VirtualizationMode="Recycling" the event Loaded does NOT get triggered when scrolling down to through the virtualized items. IS there an event that gets triggered for this case, so that I know when a virtualized item is now in view?

Thanks.

Tracy
0
Petar Mladenov
Telerik team
answered on 19 Jan 2011, 11:00 AM
Hello Tracy,

I modified my solution in order to us 2 levels of hierarchical data. I was unable to reproduce a scenario in which the virtualization brakes the checkstate of a secondlevel Item. Could you please elaborate more on you scenario and especially the steps you do? It would be nice if you can modify the solution so that it shows the problem clearly and we would be able to investigate in depth. On the other hand , do you use Load On demand feature ,since there are some issues related to checkstate and load on demand in conjunction.
As for the events that fire when a virtualized item is being generated when you scroll down, the method in this scenario is TreeView.ItemPrepared. It fires when the visual containers (RadTreeViewitems) are generated. 
Additionally, we would highly appreciate if you send us a runnable sample demonstrating the issue. This way we would provide you with a better suited solution faster.  

All the best,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Tracy
Top achievements
Rank 1
answered on 04 Feb 2011, 11:21 PM
Sorry, I haven't replied sooner. Been real busy.

I am unable to open and/or modify the sample project as we are currently developing in VS2008.

Thanks,

Tracy
0
Petar Mladenov
Telerik team
answered on 08 Feb 2011, 06:15 PM
Hi Tracy,

I am sending you the modified version of the previous project in order to use WPF 3.5, VS 2008 and 2010 Q3 (1110) version of telerik controls. I hope you will be able to modify it in order to show the issue you have come up with. This way we would be able advice you better. Thank you for your cooperation.

Best wishes,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Tracy
Top achievements
Rank 1
answered on 01 Apr 2011, 12:52 AM
We have been able to take the time in our development cycle to incorporate the new version of your controls.  The update appears to have fixed our issue, as I was able to remove the work-around and it works.

Thank you,

Tracy
0
Aurore
Top achievements
Rank 1
answered on 22 Apr 2011, 11:55 AM
Hello,

I modified your sample to add " IsTriStateMode="True" on the treeview.

I expand the first item, uncheck it. I see the fisrt "subitems" are uncheked but not all in the sub-item0 nodes !  (scroll to item020 for sample).

If i remove virtualization, that works as i expect.

Have you an idea ?

Thanks
Aurore
0
Petar Mladenov
Telerik team
answered on 27 Apr 2011, 03:02 PM
Hello Tracy,

This is default behavior of the RadTreeView. The ContainerBindings(SL) / Style Bindings (WPF) are with higher priority than the TriState logic when a RadtreeViewItem is being realized. This happens when you scroll down to a non-realized item and the tree is virtualized or when the tree is not virtualized and you uncheck  a parent and the expand it so that its child items get realized. So currently you will have to implement your TriState logic in the ViewModel.
You can also vote for this issue here in order to increase its priority.

Kind regards,
Petar Mladenov
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
Tags
TreeView
Asked by
Tracy
Top achievements
Rank 1
Answers by
Tracy
Top achievements
Rank 1
Petar Mladenov
Telerik team
Aurore
Top achievements
Rank 1
Share this question
or