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

[Solved] Check / Uncheck RadTreeViewItem not take affect in children node

6 Answers 171 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Huy Truong The
Top achievements
Rank 1
Huy Truong The asked on 30 Jun 2009, 11:26 AM

Hello,


My purpose is to check/unchecked the parent node, all its children node will be applied. But, it seems that it does not work for my case.

The children level nodes does not take affect when check / uncheck the parent node in case the telerikNavigation:RadTreeView.ItemTemplate is defined.

 

Code xample:

 

       <telerikNavigation:RadTreeView    x:Name="radtvJobs" IsLoadOnDemandEnabled="True" Grid.Row="0" Grid.Column="0" IsRootLinesEnabled="True"   IsOptionElementsEnabled="True"                                                         IsLineEnabled="True"    HorizontalAlignment="Left" VerticalAlignment="Top"  ItemPrepared="radtvJobs_ItemPrepared"

ItemsOptionListType="CheckList"     SelectionMode="Extended" LoadOnDemand="radtvJobs_LoadOnDemand" >

                    <telerikNavigation:RadTreeView.ItemTemplate>

                        <telerik:HierarchicalDataTemplate>

                            <!--<StackPanel Orientation="Horizontal" VerticalAlignment="Center" >-->

                                <Grid>

                                    <Grid.ColumnDefinitions>

                                        <ColumnDefinition Width="0.05*"></ColumnDefinition>

                                        <ColumnDefinition Width="0.75*"></ColumnDefinition>

                                    </Grid.ColumnDefinitions>

                                    <TextBlock Margin="2,0,0,0" Width="150"   VerticalAlignment="Center" Text="{Binding JOB_NAME}"  TextWrapping="Wrap"   Grid.Column="0" Grid.Row="0"></TextBlock>

                                    <TextBlock  MaxWidth="450"  VerticalAlignment="Top" Text="{Binding JOB_DESCRIPTION}" TextWrapping="Wrap" Margin="10,2,2,2"   Height="Auto"   Grid.Column="1" Grid.Row="0"></TextBlock>

                                </Grid>

                            <!--</StackPanel>-->

                        </telerik:HierarchicalDataTemplate>

                    </telerikNavigation:RadTreeView.ItemTemplate>

                   

                </telerikNavigation:RadTreeView>

Do you have any suggestions for this case?

Thank you for your help


Best regards,

Huy

6 Answers, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 01 Jul 2009, 06:24 AM
Hi Huy,

If you want the check state of individual treeview items to propagate to their children, you need to set RadTreeView's IsTriStateMode property to true. Below is an example:

<

 

telerikNavigation:RadTreeView IsTriStateMode="True" IsOptionElementsEnabled="True" />

Let me know if you have further questions.

All the best,
Tihomir Petkov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Huy Truong The
Top achievements
Rank 1
answered on 01 Jul 2009, 07:51 AM
Hi,
thank you for your support. It works fine

Another question. Can I bind  the check state of individual treeview items to  a boolean property of a class? And, treeview item is automatically checked if this property is true

Thank you very much

Best regards,

Huy


0
Tihomir Petkov
Telerik team
answered on 02 Jul 2009, 11:59 AM
Hi Huy,

I prepared a sample project for you which demonstrates three possible approaches to the scenario you described. Please take a look at the project and let me know if it helps.

In short, the approaches are the following:

1) Create a proxy data source which wraps your original data items

2) Use a HierarchicalDataTemplate and use your custom ChekcBox element (note that this way you will lose the functionality provided by the IsTriStateMode property)

3) Use the ItemPrepared event and attach event handlers to the Checked and Unchecked properties of each treeview item and manually synch the appropriate property of the underlying data object.

All the best,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Huy Truong The
Top achievements
Rank 1
answered on 03 Jul 2009, 06:11 AM
Hi,
Thank you for your help.
Best regards,
Huy
0
Huy Truong The
Top achievements
Rank 1
answered on 03 Jul 2009, 06:54 AM
Hi Tihomir,
Thanks again for your sample. But it ‘s not what I wanted. My situation is like that:

 - Check/ Uncheck the parent node => All the level chidren node need to be check / uncheck

 - The check / uncheck value of TreeViewItem is binding to a Boolean property of  a object. ( I need to get all the checked items for modifying ).

Could you give me suggestions? Thanks a lot
Best regards,
Huy


0
Tihomir Petkov
Telerik team
answered on 06 Jul 2009, 07:32 AM
Hi Huy,

The third approach I suggested should work perfectly for you. You only need to set RadTreeView's IsTriStateMode property to true. I modified the sample project to demonstrate what you need to do. Please take a look and let me know if it solves the problem.

Sincerely yours,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Huy Truong The
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Huy Truong The
Top achievements
Rank 1
Share this question
or