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

disable optionlist for child items

2 Answers 33 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mallikarjun
Top achievements
Rank 1
Mallikarjun asked on 26 Nov 2011, 06:14 PM
Hi,

This is my sample for listing departments as Option list & employees as child items of each department. For departments, the option list is visible. However, i don't the optionlist for the child items. Please let me know how can i achieve this.
PS: I have attached the screen shot of the below code. I want the radio button to be visible only for "RND" and "Sales" items.
<Grid x:Name="LayoutRoot" Background="White">
       <Grid.Resources>
           <local:DepartmentCollection x:Key="departments"></local:DepartmentCollection>
           <DataTemplate x:Key="EmployeeTemplate">
               <TextBlock FontWeight="ExtraBold" Text="{Binding EmployeeName}"></TextBlock>
           </DataTemplate>
           <telerik:HierarchicalDataTemplate x:Key="DepartmentTemplate" ItemsSource="{Binding Employees}" ItemTemplate="{StaticResource EmployeeTemplate}"
                                            >
                
               <TextBlock Text="{Binding DepartmentName}"></TextBlock>
           </telerik:HierarchicalDataTemplate>
            
       </Grid.Resources>
       <telerik:RadTreeView IsOptionElementsEnabled="True" ItemsSource="{StaticResource departments}" Name="rdTreeView"
                                     ItemTemplate="{StaticResource DepartmentTemplate}" 
                                    ItemsOptionListType="OptionList"
                                    telerik:StyleManager.Theme="Summer"
                                    IsTriStateMode="True">
            
            
       </telerik:RadTreeView>
   </Grid>

2 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 30 Nov 2011, 02:43 PM
Hi Mallikarjun,

In your case it would be better to create a RadioButton in the DeoartmentTemplate and not use the CheckBox support of the RadTreeView:
<Grid x:Name="LayoutRoot" Background="White">
       <Grid.Resources>
             <local:DepartmentCollection x:Key="departments"></local:DepartmentCollection
           <DataTemplate x:Key="EmployeeTemplate">
               <TextBlock FontWeight="ExtraBold" Text="{Binding EmployeeName}" />
           </DataTemplate>
           <telerik:HierarchicalDataTemplate x:Key="DepartmentTemplate"
                                             ItemsSource="{Binding Employees}"
                                             ItemTemplate="{StaticResource EmployeeTemplate}">
               <StackPanel Orientation="Horizontal">
                   <RadioButton Margin="0,0,5,0" GroupName="TreeViewGroup"/>
                   <TextBlock Text="{Binding Header}" />
               </StackPanel>
           </telerik:HierarchicalDataTemplate>
 
       </Grid.Resources>
       <telerik:RadTreeView Name="rdTreeView"
                            IsOptionElementsEnabled="True"
                            ItemsSource="{StaticResource departments}"
                            ItemTemplate="{StaticResource DepartmentTemplate}"
                            telerik:StyleManager.Theme="Summer" />
   </Grid>

Give this a try and let us know if it helps.

All the best,
Tina Stancheva
the Telerik team

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

0
Mallikarjun
Top achievements
Rank 1
answered on 30 Nov 2011, 02:49 PM
Thanks for the response. Will try this. 
Tags
TreeView
Asked by
Mallikarjun
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Mallikarjun
Top achievements
Rank 1
Share this question
or