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

Only root level displays on RadTreeView + WrapPanel

1 Answer 117 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Johnson
Top achievements
Rank 1
Johnson asked on 04 Sep 2014, 01:21 PM
I have a every simple RadTreeview with 2 level deep children and a wrap panel to mimic explorer list view style.
The root level is showing fine, but beyond root level is NOT showing the children nodes.  It is, however, only showing the place holder (radtreeview.png).

It works fine if I use System.Windows.Controls.TreeView(TreeView.png), but I need to use RadTreeview.

Any help would be much appreciated.

    <Grid Margin="10" >
           <telerik:RadTreeView x:Name="trvMenu" 
                             ScrollViewer.VerticalScrollBarVisibility="Disabled">

            <telerik:RadTreeView.ItemsPanel>
                <ItemsPanelTemplate >
                    <telerik:RadWrapPanel Orientation="Vertical" />
                </ItemsPanelTemplate>
            </telerik:RadTreeView.ItemsPanel>
           
            <telerik:RadTreeView.ItemTemplate>
                <HierarchicalDataTemplate DataType="{x:Type MenuItem}" ItemsSource="{Binding Items}" >
                    <TextBlock Text="{Binding Title}" />
                </HierarchicalDataTemplate>
                
            </telerik:RadTreeView.ItemTemplate>
        </telerik:RadTreeView>
    </Grid>






1 Answer, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 08 Sep 2014, 06:57 AM
Hi Johnson,

RadTreeView is an ItemsControl and every RadTreeViewItem is an ItemsControl too. This means that with your configuration you are setting WrapPanel only for the root level items of the tree. To set it for every level, you can use the ItemContainerStyle property of the RadTreeView like so:

<telerik:RadTreeView  x:Name="treeA" HorizontalAlignment="Right" Width="300"
                               IsEditable="True" IsDragDropEnabled="True"
                               ItemTemplate="{StaticResource template}">
             <telerik:RadTreeView.ItemsPanel>
                 <ItemsPanelTemplate >
                     <telerik:RadWrapPanel Orientation="Vertical" />
                 </ItemsPanelTemplate>
             </telerik:RadTreeView.ItemsPanel>
              
             <telerik:RadTreeView.ItemContainerStyle>
                 <Style TargetType="telerik:RadTreeViewItem">
                     <Setter Property="ItemsPanel">
                         <Setter.Value>
                             <ItemsPanelTemplate>
                                 <telerik:RadWrapPanel Orientation="Vertical" />
                             </ItemsPanelTemplate>
                         </Setter.Value>
                     </Setter>
                 </Style>
             </telerik:RadTreeView.ItemContainerStyle>
         </telerik:RadTreeView>

We hope this will help you move forward.

Regards,
Petar Mladenov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
TreeView
Asked by
Johnson
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or