Search code examples
c#winformstelerikbackground-colorradtreeview

How to change color of radtreeview Telerik UI WinForms selenting and selected node


By Default RadTreeView SelectedNode BackColor is orange gradient, but I ned to change color i tryed with

RadTV_Menu_Principal.SelectedNode.BackColor = Color.DarkBlue;

But that send error message because SelectedNode is null, I need pre-configurate the colors.enter image description here


Solution

  • I found one solution, I had to create two events for my RadTreeView.

    enter code here
        private void RadTV_Menu_Principal_NodeMouseEnter(object sender, RadTreeViewEventArgs e)
        {
            ///Paint Node when begining focus
            e.Node.BackColor = Color.LightSteelBlue;
            e.Node.GradientStyle = GradientStyles.Solid;
        }
    
        private void RadTV_Menu_Principal_NodeMouseLeave(object sender, RadTreeViewEventArgs e)
        {
            ///Return the initial color when leave focus
            e.Node.BackColor = SystemColors.Highlight;
        }