TreeView Single SelectionMode

4 posts, 0 answers
  1. Kirubhananth
    Kirubhananth avatar
    4 posts
    Member since:
    Jun 2012

    Posted 15 Jun 2012 Link to this post

          I created a treeview control with 10 nodes and each of these 10 nodes are having 10 children for themselves. I set the property SelectionMode="Single" and found that only one item can be selected at a time. What really happening is i was able to select one among 10 siblings under a node and one among 10  siblings under another node. I want the solution like that i want only one item to be selected in the complete tree itself. Not one among among each node.

       Even though i gave selectionmode=single i was able to select one in each and every parent node under a tree.

    - Kirubhanant Chellam 
  2. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 18 Jun 2012 Link to this post

    Hi Kirubhananth,

    Could you provide a sample of your code? It may be the case you have set the SelectionMode on the child on a TreeView. I could help you fix this issue if you show me where you've set the property.

    If you remove all SelectionMode properties from the tree and only set it in the parent, this should solve you issue. If not, let me know and I'll help you sort this out.

    Good Luck,
  3. DevCraft R3 2016 release webinar banner
  4. Kirubhananth
    Kirubhananth avatar
    4 posts
    Member since:
    Jun 2012

    Posted 19 Jun 2012 Link to this post

       The XAML is here. I am setting the  SelectionMode="Single" in the parent node itself

     <telerikNavigation:RadTreeView x:Name="TreeView" Width="Auto" 
                                               ItemsSource="{Binding NodeList}"
                                               IsOptionElementsEnabled="True" IsSingleExpandPath="True" 
                                               SelectionMode="Single" IsTriStateMode="True"
                                               IsLoadOnDemandEnabled="True" IsVirtualizing="True"
                                               ItemContainerStyle="{StaticResource RadTreeViewItemStyle1}" 
                                             Foreground="{StaticResource MainTextColor}" ItemsPanel="{StaticResource ItemsPanelTemplate1}">

                    <telerik:HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="{Binding NodeIcon}" Width="14" />
                            <TextBlock Text="{Binding DisplayText}" Style="{StaticResource TextBlockForeground}" ToolTipService.ToolTip="{Binding ToolTip}" />
  5. Petar Mladenov
    Petar Mladenov avatar
    2882 posts

    Posted 22 Jun 2012 Link to this post

    Hello Kirubhananth,

    SelectionMode is property of the RadTreeView and it cannot be set on child RadTreeViewItems.
    I used your code snippet but I was unable to reproduce such issue. Could you please check it out and try to modify it so that the issue is reproducible ?  Thank you in advance.

    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top