public SplitButton Generate(TupleList <string, Func <bool> > buttonList, Direction direction = Direction.Down, string imageName = null) { this.imageName = imageName; DynamicDropDownMenu menu = CreateMenu(direction); menu.Margin = new BorderDouble(); Button button = CreateButton(buttonList [0]); for (int index = 1; index < buttonList.Count; index++) { menu.addItem(buttonList[index].Item1, buttonList[index].Item2); } SplitButton splitButton = new SplitButton(button, menu); return(splitButton); }
public DynamicDropDownMenu Generate(string label = "", TupleList <string, Func <bool> > optionList = null, Direction direction = Direction.Down) { DynamicDropDownMenu menu = new DynamicDropDownMenu(label, CreateButtonViewStates(label), direction); menu.VAnchor = VAnchor.ParentCenter; menu.HAnchor = HAnchor.FitToChildren; menu.MenuAsWideAsItems = false; menu.AlignToRightEdge = true; menu.NormalColor = normalFillColor; menu.HoverColor = hoverFillColor; menu.BorderColor = normalBorderColor; menu.BackgroundColor = menu.NormalColor; if (optionList != null) { foreach (Tuple <string, Func <bool> > option in optionList) { menu.addItem(option.Item1, option.Item2); } } return(menu); }
public void addItem(string name, Func <bool> clickFunction) { altChoices.addItem(name, clickFunction); }