I have a TabControl
and add TabItem
on TabControl
with DataGrid
. But if I double click on range crashes:
"EditItem" is not allowed for this view.
System.Windows.Controls.DataGrid dataGrid = new System.Windows.Controls.DataGrid();
DataGridTextColumn textColumn = new DataGridTextColumn();
textColumn.Header = "ID";
textColumn.Binding = new Binding("ID");
dataGrid.Columns.Add(textColumn);
item.Content = dataGrid;
tabControl1.Items.Add(item);
When add Item:
list_datagrid[tabControl1.SelectedIndex].Items.Add(.list_item[tabControl1.SelectedIndex][i]);
Please tell me how to remove the error.
Set the ItemsSource
of the DataGrid
to the collection that DataGrid
can use to generate the view that implements IEditableCollectionView
. This interface has function EditItem()
which let the editing happen.
I have answered the similar question here WPF datagrid "EditItem is not allowed for this view" exception
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.