我以编程方式添加 DataGrid
:
System.Windows.Controls.DataGrid dataGrid = new System.Windows.Controls.DataGrid();
dataGrid.GridLinesVisibility = DataGridGridLinesVisibility.None;
dataGrid.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
dataGrid.Background = Brushes.White;
DataGridTextColumn textColumn = new DataGridTextColumn();
textColumn.Width = 250;
textColumn.Header = "Account";
textColumn.Binding = new Binding("Account");
dataGrid.Columns.Add(textColumn);
当我添加项目时:
Globals_Liker.list_datagrid [tabControl1.SelectedIndex] .Items.Add (Globals_Liker.list_item [tabControl1.SelectedIndex] [i]);
但如果我双击项目,就会出现错误:
此视图不允许“EditItem”。
如何避免弹出这个错误?