I have a problem with setting a correct data property for DataPropertyName of DataGridViewComboBoxColumn. I have a BindingSource and I set its DataSource to BindingList of custom objects. These objects have properties which I'd like to assign as columns in DataGridView (pluginsDataGrid):
var source = new BindingSource {DataSource = _plugins};
pluginsDataGrid.AutoGenerateColumns = false;
pluginsDataGrid.DataSource = source;
Everything's fine when I have a simple string as a property - it is Name:
using (var nameCol = new DataGridViewTextBoxColumn())
{
nameCol.DataPropertyName = "Name";
nameCol.Name = "Name";
pluginsDataGrid.Columns.Add(nameCol);
}
but I don't know how to set DataGridViewComboBoxColumn options. I gave it a try this way:
using (var depCol = new DataGridViewComboBoxColumn())
{
depCol.DataPropertyName = "Dependencies";
depCol.Name = "Dependencies";
pluginsDataGrid.Columns.Add(depCol);
}
where Dependencies is a list of strings. But it is not working. What kind of property should be assign to it?