Using SetPropertyValueCommand

4 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Jul 2010

    Posted 29 Jul 2010 Link to this post

    I am trying to add checkboxes to a RadTreeView, but I only want the checkboxes to be on one level of the tree.  I have discovered that to do this, I need to turn on checkboxes for the entire tree, and then suppress them where I don't want them.  As far as I can tell, using the SetPropertyValueCommand in an Execute would do this, but I haven't been able to find any code showing how this would be done.  I need to know how to specify which property is being changed, and how to specify that value.

    Otherwise, if there is a better way to accomplish the task, I would appreciate hearing the solution.  Any advice would be appreciated.
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 03 Aug 2010 Link to this post

    Hello David, 

    Thank you for writing.

    RadTreeNode has a ShowCheckBox property which you can use to explicitly hide the check box. You can write a recursive method that hides all check boxes on particular levels. For example:
     
    RadTreeView treeView = new RadTreeView();
    int[] levels = new int[] { 1, 5, 7 };
     
    private void HideCheckBoxes(RadTreeNodeCollection nodes)
    {
        foreach(RadTreeNode n in nodes)
        {
            if (levels.Contains(n.Level))
            {
                n.ShowCheckBox = false;
            }
     
            this.HideCheckBoxes(n.Nodes);
        }
    }
     
    The function is invoked like this:
     
    this.HideCheckBoxes(this.treeView.Nodes);
     
    Write again if you have other questions.

     

    Greetings,
    Victor
    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Claude
    Claude avatar
    63 posts
    Member since:
    Apr 2009

    Posted 04 Aug 2010 Link to this post

    The problem is, the node.ShowCheckBox = false statement does not always work, as noted in the other thread with that title.  It certainly didn't work on the highest level of the tree.
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 06 Aug 2010 Link to this post

    Hi Claude,

     I have replied to your reply on the other thread about the same issue.

    Greetings,
    Victor
    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
Back to Top