How to use a ComboBoxCell inside a GridView in Rhino 8 / Eto.Forms?

Hello,

I am developing a Rhino 8 plugin in C# using Eto.Forms.

I have a GridView with editable cells and everything works correctly with TextBoxCell. Users can edit values directly in the table and the underlying model is updated.

Now I would like to replace some text cells with dropdown lists (ComboBoxCell).

For example, I have columns such as “Limit 1” and “Limit 2” where the user should be able to choose a value from a predefined list instead of typing text manually.

I found several Eto.Forms examples online using ComboBoxCell, such as:

new ComboBoxCell

{

DataStore = new List

{

“Option A”,

“Option B”,

“Option C”

},

Binding = Binding.Property<MyItem, string>(x => x.Option)

}

However, I am having trouble getting this to work in Rhino 8.

My main issue is that when I click on the cell and select a value from the dropdown, the selected value is not displayed in the cell and the underlying model is not updated.

I also encountered binding errors when trying to use examples found online :

Cannot implicitly convert type ‘Eto.Forms.IndirectBinding’

to ‘Eto.Forms.IIndirectBinding’

Hi @filali_lydia,

Does this help?

– Dale

Hi Dale,

Thank you for the example, it helped me get the ComboBoxCell to display the initial value and open correctly with a single click.

However, I’m still running into another issue:

- The initial value is displayed correctly (e.g. “Test 1”).

- The dropdown opens correctly.

- When I select a different value (e.g. “Test 2”), the cell continues to display the original value instead of the newly selected one.

I reproduced this with a simplified test based on your sample:

```csharp

public class TestItem

{

public string Value { get; set; }

}

public class ComboTestDialog : Dialog

{

public ComboTestDialog()

{

var grid = new GridView();

grid.Columns.Add(new GridColumn

{

HeaderText = “Test”,

Editable = true,

DataCell = new ComboBoxCell(“Value”)

{

DataStore = new string[]

{

“Test 1”,

“Test 2”,

“Test 3”

}

}

});

grid.DataStore = new[]

{

new TestItem

{

Value = “Test 1”

}

};

grid.MouseUp += (s, e) =>

{

if (!grid.IsEditing)

{

var cell = grid.GetCellAt(e.Location);

if (cell != null &&

cell.RowIndex >= 0 &&

cell.Type == GridCellType.Data)

{

grid.BeginEdit(cell.RowIndex, cell.ColumnIndex);

e.Handled = true;

}

}

};

Content = grid;

}

}

Hi @filali_lydia,

The link above has a full working sample. Did you build and run it?

– Dale