Add TypeConverter attribute to enum in runtime Add TypeConverter attribute to enum in runtime wpf wpf

Add TypeConverter attribute to enum in runtime


This can be done using TypeDescriptor class https://msdn.microsoft.com/en-us/library/system.componentmodel.typedescriptor.aspx. Refer the below sample.

    Attribute[] newAttributes = new Attribute[1];    newAttributes[0] = new TypeConverterAttribute(typeof(LocalizedEnumTypeConverter));    TypeDescriptor.AddAttributes(MyEnum, newAttributes);