Problem with Eto CustomCell

Hi,

I’m trying to use the TreeGridView of Eto with custom cells.
Documentation is scarce regarding this Eto class so I’m asking here …

Here’s the code. I’m just trying to make a cell that displays a Label for now :

CustomCell treecell = new CustomCell {
	CreateCell = (args) => {
		Label label = new Label{ Text = "hello" };
		return label;
	},
	ConfigureCell = (args, control) => {
		Label label = control as Label;
		label.DataContext = args.Item;
	}
};

TreeGridView view = new TreeGridView {
	DataStore = collection,
	ShowHeader = false,
	AllowColumnReordering = false
};
view.Columns.Add(new GridColumn { HeaderText = "hello", Visible = true, DataCell = treecell });

As seen in the following picture, the ‘tree’ behavior is there (nodes can be expanded and such …), though the label is not appearing :

Sans%20titre

Has anyone used a TreeGridView ?
With custom cells ?
Is the version of Eto bundled with Rhino up to date ?

I’ve seen this post in the Rhino forums where the user tells that the CustomCell feature didn’t work on Mac at the time. Is this related ? (I’m on Windows though)

Thank you for your time
Alexandre

@curtisw, can you give your wisdom on the matter?

Hi @Alexandre_Beaudet,

If you just want a text column, then use a TextBoxCell. If you don’t want the items in the column editable, set the cell’s Editable property to false.

var control = new TreeGridView
{
  Size = new Size(100, 150)
};

control.Columns.Add(new GridColumn
{
  DataCell = new ImageTextCell(0, 1),
  HeaderText = "Image and Text",
  AutoSize = true,
  Resizable = true,
  Editable = false
});

control.Columns.Add(new GridColumn
{
  DataCell = new TextBoxCell(2),
  HeaderText = "Text",
  AutoSize = true,
  Width = 150,
  Resizable = true,
  Editable = false
});

Does this help?

– Dale

Thanks @dale

The TextBoxCell works fine, though I wanted to display an item with an icon, title and subtitle.
I simplified my code to show that it doesn’t even work for displaying a simple Label :confused:

I thought the CustomCell could be used to do that (it has a CreateControl event that allow the user to return anything that inherits from the Control class).
When debugging using Visual Studio, I can see the event is not even called prior to displaying the TreeGridView !

Hi @Alexandre_Beaudet,

The above code does this, with the subtitle being in it’s own column.

Your’re welcome to try my sample.

SampleEtoTreeGrid.zip (47.1 KB)

– Dale

Oh, my bad I didn’t catch that an image was displayed !
It could work then :slight_smile:

Anyway I’m still wondering how to operate the CustomCell properly … It could be very useful if, say, I want to display data in a different layout.

Hi Dale,

Thanks for posting this, looks very helpful for me too.

Have a great weekend,

Jon

Hey, two things !

  1. The CustomCell issue seems to have been fixed (issue with Wpf)
  2. The Fix states that using a CustomCell as first column doesn’t work

I’ve just tried using it as a second Column and it works fine now :))))
I hope it will do until that fix gets into Rhino 6 eventually

Thank you @nathanletwory for the info !

Alexandre

It will be in the next RC of 6.7.

1 Like