views:

104

answers:

1

I've got a list of Definition objects (definitions), each Definition object has a list of its Arguments and Parameters. This code works fine:

private void BindDefinitions()
        {
            definitionsComboBox.DataSource = definitions;
            argumentsComboBox.DataBindings.Add("DataSource", definitions, "Arguments");
            parametersComboBox.DataBindings.Add("DataSource", definitions, "Parameters");
        }

Somewhere else I've got a list of Validation objects (validations), each Validation object has a Dictionary of its Arguments and a Dictionary of Parameters. Why is the following code not working?

validationsListBox.DataSource = validations;
        argumentsDataGridView.DataBindings.Add("DataSource", validations, "Arguments");
        parametersDataGridView.DataBindings.Add("DataSource", validations, "Parameters");

Edit: the point is to make data displayed in dataGridViews dependent on selected item in validationsListBox

+2  A: 

I've found such an answer: "You can't bind a dictionary to a DataGridView because the DataGridView.DataSource needs an object that implements IList, IListSource, IBindingList, or IBindingListView.". this is probably the reason.

agnieszka
d'oh! I missed the word "dictionary" in the question. Yup - you can't do that.
Marc Gravell