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

Using SetPropertyValueCommand

3 Answers 77 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 29 Jul 2010, 07:37 PM
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.

3 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 03 Aug 2010, 10:13 PM
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
0
Claude
Top achievements
Rank 1
answered on 04 Aug 2010, 08:25 PM
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.
0
Victor
Telerik team
answered on 06 Aug 2010, 04:07 PM
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
Tags
Treeview
Asked by
David
Top achievements
Rank 1
Answers by
Victor
Telerik team
Claude
Top achievements
Rank 1
Share this question
or