public MenuEditor2(TabloidMenu mn) { InitializeComponent(); _menu = mn; _viewer = new GenericPropertiesViewer <TabloidMenu, TabloidConfigMenuItem>() { Dock = DockStyle.Fill, HelpColor = System.Drawing.Color.FromArgb(255, 56, 214, 8), TitleColor = System.Drawing.Color.FromArgb(255, 39, 153, 4), TypesName = "Menu", TypeName = "Menu", EnableMove = true, EnableDelete = true, OnAddElement = addMenu, SearchInProperty = "Table", ChildPropertyName = "SousMenu", DisplayPropertyName = "Titre", }; Controls.Add(_viewer); _viewer.SetObjectCollection(mn); }
private void addMenu(object sender, GenericPropertiesViewer <TabloidMenu, TabloidConfigMenuItem> .AddEventArgs e) { var item = _viewer.SelectedObject; var newChild = new TabloidConfigMenuItem { Titre = "Nouveau", Parent = item }; Tools.AddWithUniqueName(_menu, newChild, "M", item == null?null: item.SousMenu); _viewer.SetObjectCollection(_menu); }