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

Radio buttons on TreeView

5 Answers 138 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Lisa
Top achievements
Rank 1
Lisa asked on 05 Aug 2011, 11:28 PM
<telerik:RadTreeViewItem x:Name="tviWsaSchoolYear" Header="WSA School Year"
                          ItemsSource="{Binding WsaSchoolYearFilters}"
                          ItemsOptionListType="OptionList"
                          ItemTemplate="{StaticResource WsaSchoolYearTreeViewTemplate}"
                          Visibility ="{Binding Path=sfv.sfvWsaSchoolYearFlag, Converter={StaticResource visibilityConverter}}"/>                    
Hi - we have a tree view with mixed items, by that I mean that some are multi-select with checkboxes, some are single select with radio buttons.  See attached for an example.

Is there any way to disable the checkbox on those items that have radio buttons and keep it in the same TreeView?

Setting up the container binding:

<telerikControls:ContainerBindingCollection x:Key="TreeViewBindingsCollection">
     <telerikControls:ContainerBinding PropertyName="CheckState" Binding="{Binding CheckState, Mode=TwoWay}" />
 </telerikControls:ContainerBindingCollection>

setting up the template:
<telerikControls:HierarchicalDataTemplate x:Key="WsaSchoolYearTreeViewTemplate"
                                          ItemsSource="{Binding fltWsaSchoolYear_Result}" telerikControls:ContainerBinding.ContainerBindings="{StaticResource TreeViewBindingsCollection}">
    <TextBlock Text="{Binding SchoolYear}" FontSize="11"  />
</telerikControls:HierarchicalDataTemplate>

For the treeview
<telerik:RadTreeViewItem x:Name="tviWsaSchoolYear" Header="WSA School Year"
                          ItemsSource="{Binding WsaSchoolYearFilters}"
                          ItemsOptionListType="OptionList"
                          ItemTemplate="{StaticResource WsaSchoolYearTreeViewTemplate}"
                          Visibility ="{Binding Path=sfv.sfvWsaSchoolYearFlag, Converter={StaticResource visibilityConverter}}"/>                    

Thanks.

Lisa

5 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 10 Aug 2011, 12:53 PM
Hello Lisa,

 You can examine this help article. Basically, you can bind both ItemsOptionListType or OptionType property of the RadTreeViewItem to a property of type OptionListType from your ViewModel via ContainerBindings.
Please let us know if you need further assistance on this.

Regards,
Petar Mladenov
the Telerik team

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

0
Lisa
Top achievements
Rank 1
answered on 10 Aug 2011, 04:56 PM
Thank you, that did give me the answer. 

I set the OptionType property on that RadTreeView Item to "none", and it looks just like I wanted(No checkbos) and is working well.
0
Lisa
Top achievements
Rank 1
answered on 10 Aug 2011, 09:58 PM
One thing, in the example in the article you linked to me, the code snippet seems to be missing something.  The text talks about the OptionType property on the "Tennis" item being set, but I don't see that in the code snippet.  Attached is a screen shot.
0
Petar Mladenov
Telerik team
answered on 15 Aug 2011, 12:20 PM
Hello Lisa,

 We logged this as a bug in our documentation and we will fix it this week. We also updated your telerik account points as a thanks for your cooperation.

Kind regards,
Petar Mladenov
the Telerik team

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

0
Lisa
Top achievements
Rank 1
answered on 16 Aug 2011, 04:05 PM
Thanks!
Tags
TreeView
Asked by
Lisa
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Lisa
Top achievements
Rank 1
Share this question
or