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

1k Views Asked by At

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

2

There are 2 best solutions below

0
LOORENITAX On BEST ANSWER

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;
    }
0
checho On

The correct way to achieve this is to edit the theme you are using using the Visual Style Builder tool.

The other approach is to use code to override the theme values.