public void CopyPasteEnumInBindingList() { var list = new BindingList <ClassWithEnum> { new ClassWithEnum { Type = FruitType.Banaan }, new ClassWithEnum { Type = FruitType.Peer } }; var tableView = new TableView { Data = list }; var editor = DefaultTypeEditorFactory.CreateComboBoxTypeEditor(); editor.Items = Enum.GetValues(typeof(FruitType)); tableView.Columns[0].Editor = editor; var tableViewCopyPasteController = new TableViewPasteController(tableView); //select 2nd row tableView.SelectCells(1, 0, 1, 0); //paste twee bananen en een peer ;) tableViewCopyPasteController.PasteLines(new[] { "Banaan", "Banaan", "Peer" }); //we should have 3 bananas and a pear Assert.AreEqual("Banaan", "Banaan", "Banaan", "Peer", list.Select(c => c.Type).ToArray()); //WindowsFormsTestHelper.ShowModal(tableView); }
public void FilePathTypeEditor() { var items = new List <FilePathEntry>(); var tableView = new TableView { Data = new BindingList <FilePathEntry>(items) }; var filePathTypeEditor = DefaultTypeEditorFactory.CreateFilePathEditor(); filePathTypeEditor.FileFilter = "Assembly Files (*.dll;*.exe)|*.dll;*,exe"; filePathTypeEditor.Title = "Select assemblies ..."; tableView.Columns[0].Editor = DefaultTypeEditorFactory.CreateFilePathEditor(); WindowsFormsTestHelper.ShowModal(tableView); }
public void ComboBoxTypeEditor() { // types of the item, to be shown in the combo box var itemTypes = new[] { new ItemType { Name = "item type1" }, new ItemType { Name = "item type2" }, new ItemType { Name = "item type3" } }; // default items var items = new EventedList <Item> { new Item { Name = "item1", Type = itemTypes[0] }, new Item { Name = "item2", Type = itemTypes[1] } }; var tableView = new TableView { Data = new BindingList <Item>(items) }; var comboBoxTypeEditor = DefaultTypeEditorFactory.CreateComboBoxTypeEditor(); comboBoxTypeEditor.Items = itemTypes; // items to be shown in the combo box tableView.Columns[1].Editor = comboBoxTypeEditor; // inject it under the 2nd column WindowsFormsTestHelper.ShowModal(tableView); }