Constructor EnumUI-1.EnumUI(+ 2 overloads)
Overload
Adds enum members to a popupMenu menu as checkbox-items (if it's a [Flags]
enum) or radio-items.
public EnumUI(popupMenu m, TEnum init = default, (TEnum value, string text)[] items = null, bool sort = false)
Parameters
m (popupMenu) |
init (TEnum)
Initial value. |
items ((TEnum value, string text)[])
Enum members and their text/tooltip. Optional. Text can be: |
sort (bool)
Sort by name. |
Examples
var m = new popupMenu();
var f = new EnumUI<KMod>(m, KMod.Ctrl|KMod.Alt); //a [Flags] enum
m.Separator();
var e = new EnumUI<DayOfWeek>(m, DateTime.Today.DayOfWeek); //a non-[Flags] enum
m.Show();
print.it(f.Result);
print.it(e.Result);
See Also
Overload(next)
Adds members of a [Flags]
enum as checkboxes to a WPF panel.
public EnumUI(Panel container, TEnum init = default, (TEnum value, string text)[] items = null, bool sort = false)
Parameters
container (Panel)
StackPanel, WrapPanel or Grid. If Grid without columns, adds 2 columns. |
init (TEnum)
Initial value. |
items ((TEnum value, string text)[])
Enum members and their text/tooltip. Optional. Text can be: |
sort (bool)
Sort by name. |
Examples
With wpfBuilder.
b.R.StartStack(vertical: true);
var e = new EnumUI<KMod>(b.Panel, KMod.Ctrl|KMod.Alt);
b.End();
...
print.it(e.Result);
See Also
Overload(top)
Adds members of a non-[Flags]
enum to a WPF ComboBox or other Selector control.
public EnumUI(Selector container, TEnum init = default, (TEnum value, string text)[] items = null, bool sort = false)
Parameters
container (Selector) |
init (TEnum)
Initial value. |
items ((TEnum value, string text)[])
Enum members and their text/tooltip. Optional. Text can be: |
sort (bool)
Sort by name. |
Examples
b.R.Add("Dock", out ComboBox cb1);
var e = new EnumUI<Dock>(cb1);
...
print.it(e.Result);