TreeGridView BackgroundColor

Hey Developers!

Has anyone figured out how to change the background color of an Eto TreeGridView?

The obvious doesn’t do anything:

            var treeGridView = new TreeGridView
            {
                Width = -1,
                ShowHeader = false,
                AllowColumnReordering = false,
                BackgroundColor = Eto.Drawing.Colors.Red
            };

Nor does this work:

Eto.Style.Add<TreeGridView>(null, c => c.BackgroundColor = Eto.Drawing.Colors.Red);

The closest I can get is changing the colors of individual cells but that’s not the effect I’m after:

        private static void TreeGridView_CellFormatting(object sender, GridCellFormatEventArgs e)
        {
            e.BackgroundColor = Eto.Drawing.Colors.Red;
        }

Any suggestions? @curtisw, @dale

Ah, found it!

        private static void TreeGridView_LoadComplete(object sender, System.EventArgs e)
        {
            ((TreeGridView)sender).BackgroundColor = Eto.Drawing.Colors.Transparent;
        }

The above only works in Rhino 7, Rhino 8 overrides this with a default value related to the color mode:

Dark Mode:
image

Light Mode:
image

@curtisw, do you have any suggestions on how to address this?

@mrhe Do you have steps that I can use to replicate the issue? Now that you’ve sent me the project I can try it but I didn’t see this issue when I was looking at it.

@curtisw, in the project I sent you, under Controls, you’ll find the LayerSelector class:
image

Try changing the background color of the control. I’ve found that the following was the only way to get it to work in Rhino 7:

Rhino 8, however, will always use the default value related to the current color scheme. In the light mode it’s barely noticeable due to my pale grey background for the panel, but the dark mode is obvious:
image

RH-81642 is fixed in Rhino 8 Service Release 13

1 Like