Hi experts,
let's assume an enumeration in a class
public enum ImportantValues
{
FirstValue,
[System.ComponentModel.Browsable(false)]
SecondValue,
ThirdValue
}
Pay Regard to the Attribute
Browsable, that should hide one enumeration value from the user when a Property of type
ImportantValues is displayed in a PropertyGrid.
The values must be translated to different languages in PropertyGrid. Therefore I used a custom TypeConverter and overrode ConvertTo() and ConvertFrom().
The same TypeConverter overrides
GetStandardValues() to display all the values in a drop down list.
I use
Enum.GetValues() to get the list of values from the enumeration. But that doesn't obey the Browsable attribute.
Without a custom type converter at all, values are in the drop down, correctly hiding the one with the Browsalbe(false) attribute. But the values don't get translated.
With my custom type converter but without overriding GetStandardValues(), no values at all are in the drop down.
With my current implementation of GetStandardValues(), even the non-browsable values are displayed.
How does the standard type converter get the list of values to display in the drop down list in PropertyGrid? Can I use that too?