Ответ 1
Есть ли myClass
открытый конструктор без параметров? Если нет, вы можете получить от BindingList<T>
и переопределить AddNewCore
, чтобы вызвать свой собственный конструктор.
(изменить) Альтернативно - просто оберните свой список в BindingSource
, и он может работать:
using System;
using System.Windows.Forms;
using System.Collections.Generic;
public class Person {
public string Name { get; set; }
[STAThread]
static void Main() {
var people = new List<Person> { new Person { Name = "Fred" } };
BindingSource bs = new BindingSource();
bs.DataSource = people;
Application.Run(new Form { Controls = { new DataGridView {
Dock = DockStyle.Fill, DataSource = bs } } });
}
}