public override void Activate(bool instancePreserved) { base.Activate(instancePreserved); //Init DropDown DropDownItem item1 = new DropDownItem(1, "Test1"); DropDownItem item2 = new DropDownItem(2, "Test2"); DropDownItem item3 = new DropDownItem(3, "Test3"); List<DropDownItem> dropDownItems = new List<DropDownItem> {item1, item2, item3}; DropDown dropDown = new DropDown(dropDownItems, item2) {ZIndex = 1}; dropDown.SelectionChanged += DropDownItemChanged; PanelEntries.Add(new Label("Hallo Welt") { Color = Color.OrangeRed }); PanelEntries.Add(dropDown); PanelEntries.Add(new Button("Test Button 1")); PanelEntries.Add(new Button("Test Button 2")); PanelEntries.Add(new Button("Test Button 3")); PanelEntries.Add(new CheckBox()); PanelEntries.Add(new InputText()); Vector2 itemSize = UpdateSubItemPositions(); PresentationOffset = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width/2 - itemSize.X/2, ScreenManager.GraphicsDevice.Viewport.Height/2 - itemSize.Y/2); }
public DropDown(List<DropDownItem> items, DropDownItem selectedItem) { Items = items; SelectedItem = selectedItem; _collapsed = true; Size = new Vector2(190, 30); }