Radio buttons on TreeView

6 posts, 1 answers
  1. Lisa
    Lisa avatar
    35 posts
    Member since:
    May 2011

    Posted 05 Aug 2011 Link to this post

    <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

  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 10 Aug 2011 Link to this post

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

  3. DevCraft banner
  4. Lisa
    Lisa avatar
    35 posts
    Member since:
    May 2011

    Posted 10 Aug 2011 Link to this post

    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.
  5. Lisa
    Lisa avatar
    35 posts
    Member since:
    May 2011

    Posted 10 Aug 2011 Link to this post

    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.
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Aug 2011 Link to this post

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

  7. Lisa
    Lisa avatar
    35 posts
    Member since:
    May 2011

    Posted 16 Aug 2011 Link to this post

    Thanks!
Back to Top
DevCraft banner