Is there a way to use a List like a selection-combobox in a propertyGrid?
For example, is it possible to have a class like this:
public class Foo
{
[DisplayName(nameof(SelectedBar)),
Browsable(true)]
public Bar SelectedBar { get; set; } = null;
[Browsable(false)]
public List<Bar> Bars { get; set; } = new List<Bar>() { new Bar("Bar0"), new Bar("Bar1"), new Bar("Bar2") };
}
public class Bar
{
public string Name;
public Bar(string name) { Name = name; }
public override string ToString()
{
return Name;
}
}
And in propertyGrid let me select one of the objects in the List of "Bar".
List
here?UITypeEditor
, see this MDSN walkthrough