Plugin multiple CollapsibleSections react to the same mouse event

Hi together I have a weird problem regarding EtoCollapsibleSection. I`m currently writing a plug-in (for Windows) with a custom panel that contains some collapsible sections within a scrollable area.

The problem that I encounter is that in some circumstances (I’ll get to that later on) multiple collapsible sections will collapse at the same time if one of them is clicked. This only happens if both section are open and I close one of them. I can open the sections separately as intended.

As I mentioned not all of the collapsible sections are affected and it seems to be depended on the content of the panel. For example if I reduce the content of one section it works as intended. As far as I can tell these factors might be important to reproduce the bug:

  • There must be some “larger” Labels with wrapping text be involved
  • There must be a image involved

Does anyone know about this issue or what the root problem might be?

Below is a “minimal” code snippet, that should reproduce the issue. Since I couldn’t figure out what exactly the problem is I had to play around with the parameters a bit. But this seem to reliable reproduce the bug (at least on my machine with a 4k monitor).

I also tried using only one EtoCollapsibleSectionHolder and adding both section to that. This did not change anything for me.

using Eto.Forms;
using Rhino;
using Rhino.Commands;
using Rhino.UI;
using System;
using Eto.Drawing;
using Rhino.UI.Controls;

public class OpenTestPanelCommand : Rhino.Commands.Command
{
    public const string Name = "PanelTest";
    public override string EnglishName => Name;

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
        Rhino.UI.Panels.RegisterPanel(MyPlugin.Instance, typeof(TestPanel), "Minimal Test", null);
        Panels.OpenPanelAsSibling(TestPanel.PanelID, PanelIds.Layers, true);
        return Result.Success;
    }
}


[System.Runtime.InteropServices.Guid("28494ba1-5b24-4156-9443-f9699536403f")]
public class TestPanel : Panel
{
    public static Guid PanelID => typeof(TestPanel).GUID;

    public TestPanel()
    {

        string longText = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";


        // Add a bunch of text rows to the first collapsible section.
        // If I don`t add enough lines the bug does not appear.
        DynamicLayout l1 = new DynamicLayout();
        l1.AddRow(new Label() { Text = "Content of Section 1" });
        for (int i = 0; i < 25; i++)
        {
            l1.AddRow(new Label() { Text = longText });
        }

        EtoCollapsibleSectionHolder holder1 = new EtoCollapsibleSectionHolder() { UseScrollbars = false };
        holder1.Add(new CollapsableSection("Section 1") { Content = l1 });

        // The second section must have a texture. If i remove this one it works as intended
        DynamicLayout l2 = new DynamicLayout();
        l2.AddRow(new Label() { Text = "Content of Section 2" });
        l2.AddRow(Bitmap.FromResource("Project.EmbeddedResources.placeholder.png")); //1024x512 pixel

        EtoCollapsibleSectionHolder holder2 = new EtoCollapsibleSectionHolder() { UseScrollbars = false };
        holder1.Add(new CollapsableSection("Section 2") { Content = l2 });

        DynamicLayout layout = new DynamicLayout();
        layout.ApplyDefaultStyles();
        layout.AddRow(holder1);
        layout.AddRow(holder2);
        layout.Width = 200; //Avoid horizontal scrolling and force text wrap

        Scrollable scrollable = new Scrollable() { Content = layout };
        Content = scrollable;
    }
}

class TestCollapsableSection : EtoCollapsibleSection
{
    private LocalizeStringPair caption;
    public override LocalizeStringPair Caption => caption;
    public override int SectionHeight => this.Content.Height;

    public TestCollapsableSection(string label)
    {
        caption = new LocalizeStringPair(label, label);
    }
}