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

CheckBox in Tree Part of the TreeListView

6 Answers 314 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
gans
Top achievements
Rank 1
gans asked on 20 Mar 2012, 10:14 PM
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.  


6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 Mar 2012, 07:37 AM
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 >>
0
gans
Top achievements
Rank 1
answered on 21 Mar 2012, 02:48 PM
Do you guys have an example that does this?
0
Vlad
Telerik team
answered on 21 Mar 2012, 02:51 PM
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 >>
0
gans
Top achievements
Rank 1
answered on 21 Mar 2012, 10:50 PM
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. 


0
gans
Top achievements
Rank 1
answered on 22 Mar 2012, 08:25 PM
Vlad - Any help please on this is greatly appreciated. 
0
Vlad
Telerik team
answered on 23 Mar 2012, 08:02 AM
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 >>
Tags
TreeListView
Asked by
gans
Top achievements
Rank 1
Answers by
Vlad
Telerik team
gans
Top achievements
Rank 1
Share this question
or