A
A
Artem Skopintsev2014-01-08 10:40:05
WPF
Artem Skopintsev, 2014-01-08 10:40:05

DataGrid WPF: 'EditItem' is not allowed for this view?

Good day.
I have a DataGrid on a form, it does not know in advance how many columns, they are added by a button. And there should be a fixed number of rows - 6. I add them as follows (I did not find another way): And the columns are added like this:
dataGrid.Items.Add(new object());

dataGrid.Columns.Add(new DataGridComboBoxColumn()
{
    ItemsSource = _list;
});

But now, when you try to edit some table cell, an InvalidOperationException occurs, the studio describes it like this (in additional information): "EditItem" is not allowed for this view. "
The only problem is that the number of columns is not known, otherwise it would be easy..
How to get around this? Or maybe there is another way to implement all this (but you cannot exclude the DataGrid)?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question