Check event doesn't select child items

4 posts, 0 answers
  1. spj11
    spj11 avatar
    18 posts
    Member since:
    Jun 2011

    Posted 02 Nov 2011 Link to this post

    I have a treeview with 3 levels. On select event for a parent node I would like the control to auto-check all child nodes. I see this happening only when the node is expanded. If the node is collapsed, it only checks the parent node only. Is this a bug?


  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 07 Nov 2011 Link to this post

    Hi Spj11,

    Do you actually mean Checked event instead of Select (SelectionChanged)? I guess you mean that you use the IsInTriStateMode set to true on the RadTreeView. So what happens when you check a parent node and then expand it ?
    By design, the RadTreeViewItems are generated initially when they are root level items and all other RadTreeViewItems are generated when their parent is being expanded. So when you expand a node, then its children are generated but their CheckState property does not inherit their parent's CheckState automatically. The "TriState" logic basically works only with already created containers(RadTreeViewItems). The way to workaround this is to use DataBinding with ViewModels and create your own custom Tri-State logic in these viewmodels. You can examine how this could be achieved in this code library project

    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. spj11
    spj11 avatar
    18 posts
    Member since:
    Jun 2011

    Posted 12 Jul 2012 Link to this post

    I looked at your code library project and it seems to work fine as is. When I changed the SL version to 5 and upgraded to the latest telerik controls (2012.2.607.1050), the code doesn't work anymore. Eg: unselecting a leaf level node, deselects the parent nodes among other issues, can you please look at it and let me know if this is is a bug in your control or bug in the code library.
    Thanks
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 16 Jul 2012 Link to this post

    Hello,

    You're right and this is our mistake. Actually we've created an updated version of this code library which can now be found under the TreeView category in our CodeLibrary and we also have a step-by-step tutorial on the subject in our documentation.

    The updated solution should work as expected with the latest release of the controls, but please let us know if you encounter any issues.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top