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

Check RadTreeNode check box without effecting selection

1 Answer 31 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Travis
Top achievements
Rank 1
Travis asked on 28 May 2013, 10:19 PM
Is there a way to check or uncheck a RadTreeNode checkbox without effecting the selection? For our app, it's kind of handy that we can do both, but it's also useful that we check or uncheck without impacting the selection. Or possibly vice versa (current behavior) might be acceptable. In either case, ????

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 31 May 2013, 03:24 PM
Hi Michael,

Thank you for writing.

To do that, you can inherit from RadTreeView and override the OnMouseDown method, where you can save the SelectedNode prior the base call and restore it right after. Here is an example:
class MyTreeView : RadTreeView
{
    protected override void OnMouseDown(MouseEventArgs e)
    {
        TreeNodeCheckBoxElement element = this.ElementTree.GetElementAtPoint(e.Location) as TreeNodeCheckBoxElement;
        if (element != null)
        {
            RadTreeNode saveSelectedNode = this.SelectedNode;
            base.OnMouseDown(e);
            this.SelectedNode = saveSelectedNode;
            return;
        }
        base.OnMouseDown(e);
    }
 
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadTreeView).FullName;
        }
    }
}

I hope this helps.

Regards,
Stefan
Telerik
RadChart for WinForms is obsolete. Now what?
Tags
ChartView
Asked by
Travis
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or