net472_PropertyGridHelpers.Converters_EnumTextConverter 1 - dparvin/PropertyGridHelpers GitHub Wiki
A strongly-typed generic version of EnumTextConverter
for handling enums with display text annotations in a PropertyGrid.
public class EnumTextConverter<T> : EnumTextConverter
where T : Enum
parameter | description |
---|---|
T | The enumeration type whose members are decorated with EnumTextAttribute . |
name | description |
---|---|
EnumTextConverter() | Initializes a new instance of the EnumTextConverter class. |
This converter simplifies using EnumTextAttribute
on enum members by automatically associating the generic parameter T as the enum to convert. This enables the property grid to display friendly names for enum values without requiring manual type configuration.
public enum Status
{
[EnumText("Pending Approval")]
Pending,
[EnumText("Approved")]
Approved,
[EnumText("Rejected")]
Rejected
}
[TypeConverter(typeof(EnumTextConverter<Status>))]
public Status CurrentStatus { get; set; }
- class EnumTextAttribute
- class EnumTextConverter
- namespace PropertyGridHelpers.Converters
- assembly PropertyGridHelpers
- EnumTextConverter.cs