Declined
Last Updated: 17 Jan 2020 09:16 by ADMIN
Vladimir
Created on: 01 Nov 2019 14:36
Category: TreeView
Type: Bug Report
5
TreeView: Extended selection does not work correctly with the UI Virtualization enabled when there is a large number of items selected on the first level

When a large number of items are selected through extended selection (with a lot of items on the first level of the RadTreeView) the selection does not work correctly. 

Workaround - make the selection in viewmodels manually and provide 2way bindings in style
 <telerik:RadTreeView.ItemContainerStyle>
                <Style TargetType="telerik:RadTreeViewItem">
                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                    <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                </Style>
            </telerik:RadTreeView.ItemContainerStyle>
private void SomeRadTreeView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int count = e.AddedItems.Count;
            if (count > 1)
            {
                SomeViewModel first = e.AddedItems[0] as SomeViewModel;
                SomeViewModel last = e.AddedItems[count - 1] as SomeViewModel;
                
                this.SomeRadTreeView.SelectionChanged -= this.SomeRadTreeView_SelectionChanged;
                this.SomeRadTreeView.AutoScrollToSelectedItem = false;
                this.ViewModel.SelectRange(first, last);
                this.SomeRadTreeView.AutoScrollToSelectedItem = true;
                this.SomeRadTreeView.SelectionChanged += this.SomeRadTreeView_SelectionChanged;
            }
        }

5 comments
ADMIN
Petar Mladenov
Posted on: 17 Jan 2020 09:16

Hello Arthur,

Good point regarding the UI Automation. Generally, the biggest advantage of the TreeList is that scrolling and bringing a particular item into view are much faster than in TreeView. Also filtering and sorting come out of the box whereas in TreeView you will need custom code.

Regards,
Petar Mladenov
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.
Arthur
Posted on: 10 Jan 2020 09:50

Hello Petar,

thanks for answering.

A flat UI structure has the drawback that the hierachy information is stripped from the visual tree, meaning that UI automation tools have to search the tree items in complicated ways. Hierarchy information has to be encoded in AutomationIds etc. what costs performance on view model construction and maintenance.

In addition I could not verify thet the RadTreeListView has a better performance than RadTreeView. In my example prototype I have 2.5 million nodes. I have just tested replacing the TreeView by the TreeListView, and the TreeListView does not deal well with filtering, which envolves collection view changes on all levels. In my example the UI is blocked for many seconds in HierarchicalCollectionViewBase.CreateInternalList().

Best regards,

Arthur

ADMIN
Petar Mladenov
Posted on: 09 Jan 2020 14:48

Hello Arthur,

I should admit the provided workaround is not complete and also, the SelectRange function in models might require refactoring of ViewModels. Please check out the attached project with more detailed workaround. Also if it is not applicable at your side, you can consider using RadTreeListView instead of RadTreeView. TreeList has better UI performance and maintains flat collection of ViewModels. You can check the following help article:

        Customize RadTreeListView in RadTreeView-look

Regards,
Petar Mladenov
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.
Attached Files:
Arthur
Posted on: 03 Jan 2020 11:19

The workaround does not work completely. It helps to select the virtualized items through the item view models, but is does not help to deselect virtualized items. To reproduce just select first to last item, ensure that many items are out of scrollviewer's view port. Now select a single item, which should normally deselect all others. Scroll up. The previously virtualized items are still selected.

I have spent 3 working days to find a solution for virtualization + multiselection in Telerik's RadTreeView, without success so far.

Petar
Posted on: 12 Nov 2019 13:45
We are declining this item because there is already a logged item with the same root origin: