public class ColorSource : IItemsSource
{
public IList<object> GetValues()
{
return new List<object>() { Colors.Blue, Colors.Gray, Colors.Green };
}
}
Then decorate your property with the ItemsSource attirbute and specify the Type of source to use:
private Color _color = Colors.Green;
[ItemsSource(typeof(ColorSource))]
public Color Color
{
get { return _color; }
set { _color = value; }
}
When the PropertyGrid loads, the editor for the Color property will be a ComboBox with an ItemsSource of ColorSource.GetValues().