disable optionlist for child items

3 posts, 1 answers
  1. Mallikarjun
    Mallikarjun avatar
    12 posts
    Member since:
    Jan 2011

    Posted 26 Nov 2011 Link to this post

    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. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 30 Nov 2011 Link to this post

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

  3. DevCraft banner
  4. Mallikarjun
    Mallikarjun avatar
    12 posts
    Member since:
    Jan 2011

    Posted 30 Nov 2011 Link to this post

    Thanks for the response. Will try this. 
Back to Top