naps2/NAPS2.Lib/EtoForms/Widgets/EnumDropDownWidget.cs
Ben Olden-Cooligan 4404474f00 Reset dropdown items after changing formatter
The previous implementation involved lazy item setting. This was causing layout issues in Gtk where empty dropdowns have a different size.
2024-08-10 12:43:30 -07:00

14 lines
331 B
C#

using NAPS2.Scan;
namespace NAPS2.EtoForms.Widgets;
public class EnumDropDownWidget<T> : DropDownWidget<T> where T : struct, Enum
{
public static IEnumerable<T> DefaultItems => (T[]) Enum.GetValues(typeof(T));
public EnumDropDownWidget()
{
Format = x => x.Description();
Items = DefaultItems;
}
}