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

CheckState bindind using ContainerBinding

2 Answers 37 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Abdulrahman Omran
Top achievements
Rank 1
Abdulrahman Omran asked on 10 May 2011, 12:57 AM
Hi,

I have a treeView on my user interface that consists of 3 levels. The tree is bound to objects which are linked using the HierarchicalDataTemplate.
Each Object has a property isChecked which is bound to the container's CheckState. This Works great if the user is editing the treeview by checking and unchecking the tree nodes. However, when i load the treeview items from the database i programmatically set the IsChecked property of the 3rd level node either to true or false.

<telerik:ContainerBindingCollection x:Key="TreeViewItemContainerBindings">   
 <telerik:ContainerBinding PropertyName="CheckState" Binding="{Binding IsChecked, Mode=TwoWay, Converter= {StaticResource
CheckStateConverter}}" />
</
telerik:ContainerBindingCollection>


The telerik behaviour when there is a checked child node then the checkbox of the parent will have [-] as it's state and if all of the children checkboxes are checked then parent will be checked likewise.

This is not being reflected when i programmatically check child nodes. I.e. the parent node's checkbox state doesn't reflect it's children checkstates.

Am I doing something wrong here ? and if this is the default behaviour is there an event/method that i can execute or raise so that the parent nodes will update their checkstates based on their children nodes?


Best Regards,
Abdul

  

2 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 12 May 2011, 04:21 PM
Hi Abdulrahman Omran,

Could you please examine this detailed blog post and let us know if it helps you ? There is a great sample project at the and of the post and you can use it in order to check whether you are missing something? If it doesn't help you, you can create a support ticket so that you will be able to attach a project demonstrating your problem and we will be better able to assist you. Thank you in advance for your cooperation.

All the best,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Abdulrahman Omran
Top achievements
Rank 1
answered on 13 May 2011, 08:37 PM
Thank you for your quick response.


I have read the blog and I do update the checkstate of the treeview items. However, i think the reason behind the issue i described is that i update the objects (IsChecked flag) while the view is hidden and as I understood from the blog this won't propagate the checkstate changes up the tree.


I will do more testing/modifications if that doesn't solve it, I will raise a support ticket.


Thank you, Petar.


Regards,
Abdul
Tags
TreeView
Asked by
Abdulrahman Omran
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Abdulrahman Omran
Top achievements
Rank 1
Share this question
or