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

TreeView Single SelectionMode

3 Answers 137 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kirubhananth
Top achievements
Rank 1
Kirubhananth asked on 15 Jun 2012, 06:22 AM
Hi,
      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 

3 Answers, 1 is accepted

Sort by
0
Lancelot
Top achievements
Rank 1
answered on 18 Jun 2012, 10:37 PM
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,
Lancelot
0
Kirubhananth
Top achievements
Rank 1
answered on 20 Jun 2012, 04:11 AM
Hi, 
   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"
                                           IsExpandOnSingleClickEnabled="True"
                                           IsLoadOnDemandEnabled="True" IsVirtualizing="True"
                                           ItemContainerStyle="{StaticResource RadTreeViewItemStyle1}" 
                                         Foreground="{StaticResource MainTextColor}" ItemsPanel="{StaticResource ItemsPanelTemplate1}">


            <telerikNavigation:RadTreeView.ItemTemplate>
                <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}" />
                    </StackPanel>
                </telerik:HierarchicalDataTemplate>
            </telerikNavigation:RadTreeView.ItemTemplate>
        </telerikNavigation:RadTreeView>
0
Petar Mladenov
Telerik team
answered on 22 Jun 2012, 08:57 AM
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.

Regards,
Petar Mladenov
the Telerik team

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

Tags
TreeView
Asked by
Kirubhananth
Top achievements
Rank 1
Answers by
Lancelot
Top achievements
Rank 1
Kirubhananth
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or