public void ShowTableViewWithDatatableEnumType() { //demonstrates how hard it is to add custom editor to tableview for datatable //In this case you need //a typeconverter and comboboxhelper :( //TODO: look into the differences and abstract away from it var dataTable = new DataTable(); dataTable.Columns.Add("Code", typeof(string)); dataTable.Columns.Add("SomeEnum", typeof(FruitType)); for (int i = 0; i < 10; i++) { dataTable.Rows.Add(new object[] { String.Format("Item{0:000}", i), FruitType.Appel }); } dataTable.AcceptChanges(); var tableView = new TableView {Data = dataTable}; var comboBox = new RepositoryItemImageComboBox(); XtraGridComboBoxHelper.Populate(comboBox, typeof(FruitType)); tableView.SetColumnEditor(comboBox, 1); WindowsFormsTestHelper.ShowModal(tableView); }
public void ShowTableViewWithListEnumType() { //demonstrates how easy it is to add custom editor to tableview for bindinglist<T> :) //In this case (BindingList<T> you don't need //a typeconverter or comboboxhelper :) var tableView = new TableView(); var list = new BindingList<ClassWithEnum> { new ClassWithEnum { Type = FruitType.Appel } }; tableView.Data = list; var comboBox = new RepositoryItemImageComboBox(); comboBox.Items.AddEnum(typeof(FruitType)); tableView.SetColumnEditor(comboBox, 0); WindowsFormsTestHelper.ShowModal(tableView); }