Method wpfBuilder.AddEnum
Overload
Adds enum members as StackPanel with checkboxes (if it's a [Flags]
enum) or ComboBox control.
public wpfBuilder AddEnum<TEnum>(out EnumUI<TEnum> e, TEnum init = default, (TEnum value, string text)[] items = null, string label = null, bool vertical = true) where TEnum : unmanaged, Enum
Parameters
e (EnumUI<TEnum>)
Variable for getting result later. See EnumUI<TEnum>.Result. |
init (TEnum)
Initial value. |
items ((TEnum value, string text)[])
Enum members and their text/tooltip. Optional. Text can be: |
label (string)
If not |
vertical (bool)
Vertical stack. Default |
Returns
Type Parameters
TEnum |
Examples
var b = new wpfBuilder("Window").WinSize(250);
b.R.AddEnum<KMod>(out var e1, KMod.Ctrl | KMod.Alt, label: "Modifiers", vertical: false);
b.R.AddEnum<DayOfWeek>(out var e2, DateTime.Today.DayOfWeek, label: "Day");
b.R.AddOkCancel();
if (!b.ShowDialog()) return;
print.it(e1.Result);
print.it(e2.Result);