Aaltuj / VxFormGenerator

The library contains a component, that nests itself into the Blazor EditForm instead of a wrapper around the EditForm. The component is able to generate a form based on a POCO or a ExpandoObject. Because of this architecture the library provides the developer flexibility and direct usage of the EditForm.
MIT License
119 stars 36 forks source link

Leveraging Description Attribute in Enums #19

Closed msaroka closed 3 years ago

msaroka commented 3 years ago

If an Enum uses the Description attribute could we control the text displayed in the dropdowns and multiple checkboxes?

Below is an example of what I mean.

public enum FuelType
{
    [Description("Bituminous Coal")] bit,
    [Description("Home Heating and Diesel Fuel (Distillate)")] dfo,
    [Description("Jet Fuel")] jf,
    [Description("Kerosene")] ker,
    [Description("Lignite Coal")] lig,
    [Description("Municipal Solid Waste")] msw,
    [Description("Natural Gas")] ng,
    [Description("Petroleum Coke")] pc,
    [Description("Propane Gas")] pg,
    [Description("Residual Fuel Oil")] rfo,
    [Description("Subbituminous Coal")] sub,
    [Description("Tire -Derived Fuel")] tdf,
    [Description("Waste Oil")] wo
}
Aaltuj commented 3 years ago

This is supported by the display attribute.

https://github.com/Aaltuj/VxFormGenerator/blob/786fbc52e5667df5c727dd2202c3e615ab187852/VxFormGeneratorDemoData/VxFormLayoutAnnotated.cs#L34-L42

msaroka commented 3 years ago

Perfect. Thank you.