[英]WPF DataGrid EditItem exception
I have a TabControl
and add TabItem
on TabControl
with DataGrid
. 我有一个
TabControl
并使用DataGrid
在TabControl
上添加TabItem
。 But if I double click on range crashes: 但是,如果我双击范围崩溃:
"EditItem" is not allowed for this view.
此视图不允许使用“ EditItem”。
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
. 将
DataGrid
的ItemsSource
设置为DataGrid
可用于生成实现IEditableCollectionView
的视图的集合。 This interface has function EditItem()
which let the editing happen. 该接口具有
EditItem()
函数,可以进行编辑。
I have answered the similar question here WPF datagrid "EditItem is not allowed for this view" exception 我在这里回答了类似的问题WPF datagrid“此视图不允许使用EditItem”异常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.