CheckBox in Tree Part of the TreeListView

7 posts, 0 answers
  1. gans
    gans avatar
    48 posts
    Member since:
    Jan 2012

    Posted 20 Mar 2012 Link to this post

    How do I show checkbox in the Tree Part of the TreeListView. Its very easy in TreeView where if you specify 
    IsOptionElementsEnabled= True, it shows Checkboxes and setting IsTriStateMode=True takes care of all 3 states. Do we have similar property in TreeListview?

    Could you please provide an example that shows CheckBox in the Tree Part of the TreeListView and also does the TriStateMode equivalent of TreeView?


    We really need this implemented in our project. Any help on this is really appreciated.  


  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 21 Mar 2012 Link to this post

    Hi,

    To achieve your goal you can use GridViewSelectColumn and to control selection mode you can set SelectionMode property. 

    Greetings,
    Vlad
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. gans
    gans avatar
    48 posts
    Member since:
    Jan 2012

    Posted 21 Mar 2012 Link to this post

    Do you guys have an example that does this?
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 21 Mar 2012 Link to this post

    Hello,

     You just need to add the column to the columns collection and set the property to desired value. Have you tried this?

    Greetings,
    Vlad
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. gans
    gans avatar
    48 posts
    Member since:
    Jan 2012

    Posted 21 Mar 2012 Link to this post

    Vlad,

    Yes, I tried it and its showing the CheckBox on all the nodes. I am having some issues with the way its behaving though.  These are 3 issues I have so far. Please let me know if you can help me out on this. 

    1. I want to know how to get the TriState mode behaviour that we get with TreeView. I tried both "Multiple" and "Extended" and its not selecting the child nodes when you Check the Parent node.  Is it supposed to check the child nodes automatically like it does with TreeView when you set the "IsTriStateMode=True" or we have to manually check each and every child node?

    2. I am seeing a weird behavior when you drill down the on the Parent node and close it again. There is gap between Check box and the text. I am attaching the screen shot of it. Also once you drill down and Check couple of the nodes and close them and open the nodes back again - the nodes are unchecked again- don't know why this happens. 

    3. In Treeview, when you set the "IsTriStateMode" and when you check any of the child nodes, in parent node checkbox, you will see a horizontal line indicating that some of the nodes below are selected but not all of them. Would it be possible to have same behaviour here?

    Here is the xaml entry.

    <telerik:RadTreeListView 
                            x:Name="radTreeListView"
                            AutoGenerateColumns="False" 
                            ScrollMode="RealTime"
                            GridLinesVisibility="None"
                            RowIndicatorVisibility="Collapsed"
                            ShowColumnFooters="False"
                            ShowColumnHeaders="False"                        
                            EnableRowVirtualization="True"
                            EnableColumnVirtualization="True"
                            ItemsSource="{Binding Path=Entities}"
                            RowLoaded="RadTreeListView_RowLoaded"
                            RowIsExpandedChanging="RadTreeListView_RowIsExpandedChanging"
                            SelectionChanged="RadTreeListView_SelectionChanged"
                            SelectionUnit="FullRow"
                            SelectedItem="{Binding SelectedEntity}"
                            SelectionMode="Multiple"
                            >
                            <telerik:RadTreeListView.ChildTableDefinitions>
                                <telerik:TreeListViewTableDefinition ItemsSource="{Binding Path=Children}" />
                            </telerik:RadTreeListView.ChildTableDefinitions>
                            <telerik:RadTreeListView.Columns>
                                <telerik:GridViewSelectColumn Header="" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding [NODE_NAME]}" Header="Name" />
                            </telerik:RadTreeListView.Columns>
               </telerik:RadTreeListView>


    I am also attaching the screen shots. 


  7. gans
    gans avatar
    48 posts
    Member since:
    Jan 2012

    Posted 22 Mar 2012 Link to this post

    Vlad - Any help please on this is greatly appreciated. 
  8. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 23 Mar 2012 Link to this post

    Hi,

    I'm afraid that parent/child selection will not work for this column - you will get only the behavior similar to RadGridView. Header CheckBox for select/deselect of all items and CheckBoxes for individual items selection. 

    I see that your scenario is more complex and I would like to suggest you to create your custom column where you can embed desired logic. For more info about custom columns you can check this demo

    All the best,
    Vlad
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
UI for WPF is Visual Studio 2017 Ready