Eto TreeGridView cell order issue on scrolling

Dale,

thanks for getting back so quickly. Well, this is a starting setup and I want to include much more content(controls) into the cells.

I should have had a look at this post link from @curtisw before aksing. My bad. We have a saying in Germany:

Those who are able to read
are at an advantage indeed.

protected override Control OnCreateCell(CellEventArgs args)
{
    if (args.GridColumn.Editable)
    {
        TextBox textbox = new TextBox
        {
            Height = 18,
            ShowBorder = false,
            TextAlignment = TextAlignment.Left,
        };
        textbox.TextChanged += new EventHandler<EventArgs>(this.OnTextChanged);
        return textbox;
    }
    else
    {
        return new Label
        {
            Height = 18,
            TextAlignment = TextAlignment.Left,
            VerticalAlignment = VerticalAlignment.Center,
        };
    }
}

protected override void OnConfigureCell(CellEventArgs args, Control control)
{
    if (control is Label label)
    {
        if (args.Item is TreeGridItem treeGridItem)
        {
            if (treeGridItem.Values[args.Column] is string stringValue)
            {
                if (treeGridItem.Children != null &&
                    !(treeGridItem.Values[args.Column + 1] is AFPropertyBaseType baseType))
                {
                    label.Text = stringValue + " (" + treeGridItem.Children.Count.ToString() + ")";
                }
                else
                {
                    label.Text = stringValue;
                }
            }
            else if (treeGridItem.Values[args.Column] is Tuple<string, int> tuple)
            {
                label.Text = tuple.Item1 + " (" + tuple.Item2.ToString() + ")";
            }
        }
        else if (args.Item is GridItem item)
        {
            if (item.Values[args.Column] is string stringValue)
            {
                label.Text = stringValue;
            }
        }
    }
    if (control is TextBox textBox)
    {
        if (args.Item is TreeGridItem treeGridItem)
        {
            if (treeGridItem.Values[args.Column] is string stringValue)
            {
                if (treeGridItem.Children != null &&
                    !(treeGridItem.Values[args.Column + 1] is AFPropertyBaseType baseType))
                {
                    textBox.Text = stringValue + " (" + treeGridItem.Children.Count.ToString() + ")";
                }
                else
                {
                    textBox.Text = stringValue;
                }
            }
            else if (treeGridItem.Values[args.Column] is Tuple<string, int> tuple)
            {
                textBox.Text = tuple.Item1 + " (" + tuple.Item2.ToString() + ")";
            }
        }
        else if (args.Item is GridItem item)
        {
            if (item.Values[args.Column] is string stringValue)
            {
                textBox.Text = stringValue;
            }
        }
    }
}

Seems to work fine now.

kindest
Christian