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

WrapPanel as container of subitems of expanded node

1 Answer 174 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ranko
Top achievements
Rank 1
Ranko asked on 06 Nov 2017, 10:40 AM
Hi -
I am trying to implement treeview that will have multiple expandable 1st level nodes. When one of the 1st level nodes is expanded, subitems of that node (they should not be expandable) should be displayed as a grid. I tried with setting Wrap panel for ItemsPanel, but in that case virtualization stops working.
<Style TargetType="telerik:RadTreeViewItem" x:Key="RadTreeViewItemStyle">
           <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
           <Setter Property="HorizontalContentAlignment" Value="Left"/>
           <Setter Property="VerticalContentAlignment" Value="Center"/>
           <Setter Property="BorderThickness" Value="1"/>
           <Setter Property="Padding" Value="1 4 5 4"/>
           <Setter Property="MinHeight" Value="24"/>
           <Setter Property="IsDropAllowed" Value="True"/>
           <Setter Property="IsEnabled" Value="True"/>
           <Setter Property="IsTabStop" Value="False"/>
           <Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/>
           <Setter Property="Template" Value="{StaticResource TreeViewItemDefaultTemplate}"/>
           <Setter Property="ItemsPanel">
               <Setter.Value>
                   <ItemsPanelTemplate>
                           <WrapPanel Orientation="Horizontal" VerticalAlignment="Bottom"/>
                   </ItemsPanelTemplate>
               </Setter.Value>
           </Setter>
       </Style>
When I set telerik:TreeViewPanel for ItemPanel, virtualization is working, but subitems of nodes are shown in a vertical list?

Is there any way to achieve that behavior, so subitems are shown in wrap panel, but to keep virtualization working?

Thanks in advance! 

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 09 Nov 2017, 09:56 AM
Hi Ranko,

Thank you for your interest in RadTreeView control.

Let me first start with that to enable the virtualization of the RadTreeView control you need to set the IsVirtualizing property to true of the control. In general, UI virtualization works when the control in question have a fixed Height set or when it is in a panel which is not measured with infinity. For example, ScrollViewer, StackPanel, and Grid with Row.Height=Auto or Column.Width=Auto will measure it in that way. You can read more about the RadTreeView virtualization in the UI Virtualization help article in our documentation.

I have created a sample project to test your scenario and the virtualization is working when you replace the with WrapPanel. You can find the project attached to this reply. Give this project a try and let me know if I a missing something from your implementation.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
TreeView
Asked by
Ranko
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or