Search code examples
c#.netpropertygridtypeconverter

How do I add an editable combobox to a System.Windows.Forms.PropertyGrid?


I have a System.Windows.Forms.PropertyGrid with different types of values. For a specific item, I want to show a list of useful values to choose from. The user may also type a new value. Something similar to a traditional dropdown combobox:

enter image description here

So far, I have my own System.ComponentModel.TypeConverter, but I can't figure out how to get both the dropdown with suggested values and the possibility to edit the value directly. Please help!


Solution

  • You can accomplish this by implementing your own UITypeEditor.

    I recommend reading Getting the Most Out of the .NET Framework PropertyGrid Control. In particular, the section titled Providing a Custom UI for Your Properties walks through how to make a custom control for a specific property.