WrapPanel as container of subitems of expanded node

2 posts, 0 answers
  1. Ranko
    Ranko avatar
    1 posts
    Member since:
    Feb 2017

    Posted 06 Nov 2017 Link to this post

    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">
                               <WrapPanel Orientation="Horizontal" VerticalAlignment="Bottom"/>
    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! 
  2. Dinko
    Dinko avatar
    1124 posts

    Posted 09 Nov 2017 Link to this post

    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 TreeViewPanel 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.

    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 allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top