-
I have a WPF DataGrid that shows some data records (bounded to an ObservableCollection).
我有一个WPF DataGrid,它显示了一些数据记录(绑定到一个天文台)。
-
When the user clicks "Edit" button, the currend selected row should move into edit-mode (As if the user double-clicked this row).
当用户单击“编辑”按钮时,currend选中的行应该进入编辑模式(就像用户双击这一行一样)。
-
Any idea of someone who knows how to do that ?
有人知道怎么做吗?
2 个解决方案
#1
6
Here is the documentation of the WPF DataGrid on MSDN. The BeginEdit method seems to be what you are looking for.
这是关于MSDN上WPF数据网格的文档。BeginEdit方法似乎是您正在寻找的。
PS: I don't know if this is suitable for your application, but many DataGrid users find Single-Click Editing useful.
PS:我不知道这是否适合您的应用程序,但是许多DataGrid用户发现单点编辑非常有用。
#2
4
Assuming WPF:
假设WPF:
<DataGrid x:Name="dg".... />
Then this code will work:
然后这个代码就可以工作了:
dg.CurrentCell = new DataGridCellInfo(dg.Items[i], dg.Columns[j]);
dg.BeginEdit();
#1
6
Here is the documentation of the WPF DataGrid on MSDN. The BeginEdit method seems to be what you are looking for.
这是关于MSDN上WPF数据网格的文档。BeginEdit方法似乎是您正在寻找的。
PS: I don't know if this is suitable for your application, but many DataGrid users find Single-Click Editing useful.
PS:我不知道这是否适合您的应用程序,但是许多DataGrid用户发现单点编辑非常有用。
#2
4
Assuming WPF:
假设WPF:
<DataGrid x:Name="dg".... />
Then this code will work:
然后这个代码就可以工作了:
dg.CurrentCell = new DataGridCellInfo(dg.Items[i], dg.Columns[j]);
dg.BeginEdit();