thomas
(Thomas)
February 18, 2016, 4:26pm
1
So, I have a nice little Eto dropdown that should get populated from a list with custom objects.
The following code works in Windows (RH6), but fails in Mac. In the latter, instead of text values, the control shows the object type.
class MyObject
{
public string Key { get; set; }
public string Name { get; set; }
}
//---------------------
List<MyObject> myObjects = new List<MyObject>();
// ... fill list
var selector = new DropDown
{
DataStore = myObjects,
ItemKeyBinding = Binding.Delegate<myObject, string>(a => a.Key),
ItemTextBinding = Binding.Delegate<myObject, string>(a => a.Name),
};
In Mac, the selector shows the type name instead of the name values:
MySolution.MyObject
MySolution.MyObject
MySolution.MyObject
MySolution.MyObject
MySolution.MyObject
Is this a bug or am I missing something?
menno
(Menno Deij - van Rijswijk)
February 18, 2016, 8:06pm
2
It sounds like a bug to me, but you’re probably better off reporting it directly on GitHub
https://github.com/picoe/Eto/issues as it seems not Rhino-related.
dale
(Dale Fugier)
February 18, 2016, 8:45pm
3
@curtisw , is this something you can confirm (or deny)?
menno
(Menno Deij - van Rijswijk)
February 18, 2016, 9:14pm
4
Thinking about it, I knew I ran into this recently, and it is already in the issues list
The solution is to override the ToString()
for the display code; in your case you may have to do some more to get it right.
1 Like
thomas
(Thomas)
February 19, 2016, 1:27pm
5
Thank you, Menno.
For the time being, I was able to make a rather clumsy workaround by assigning the string values directly via selector.Items.Add(...)
curtisw
(Curtis Wensley)
February 19, 2016, 8:58pm
6
Yeah this is a known problem as @menno pointed out. I didn’t know it had the same problem on OS X, so thanks for letting me know!
I’ve updated the issue to reflect this.
Thanks!
Curtis.