WPF使特定列可编辑 [英] WPF make a specific column editable

查看:116
本文介绍了WPF使特定列可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是WPF的新手,在操作Gridview时需要帮助.

下面的行用方法LoadPSVGrid()返回的列表填充了我的datagrid.

Hi,

I am new to WPF and need help in manipulating my Gridview.

The below line fills my datagrid with a list returned from the method LoadPSVGrid().

dgPointSpeedVector.ItemsSource = LoadPSVGrid();


现在我的问题是,我希望网格中的特定列(或2)允许用户进行编辑.

让这些列为名称",课程",部门",地址".

我想允许用户修改课程和部门(如果可能的话,以反映我数据库中的更改,到目前为止,我不确定它的数据库部分).

谢谢
Nishitha


Now my issue is, I want a specific column(or 2) in the grid to allow user to edit.

Let the columns be Name, Course, Dept, Address.

I want to allow the user to modify Course and Dept (and if possible to reflect the change in my DB, as of now I am not sure about the DB part of it).

Thanks
Nishitha

推荐答案

DataGrid类的BeginEdit方法可帮助您使每个单元格处于自定义编辑模式.参考: http://msdn.microsoft.com/en-us/library/cc189733.aspx [ ^ ]

以下是负载处理程序中的示例代码:

BeginEdit method of DataGrid class, helps you to make each cell in customized edit mode. Ref at: http://msdn.microsoft.com/en-us/library/cc189733.aspx[^]

Herez the sample code in Load handler:

dgPointSpeedVector.CurrentCell = new DataGridCellInfo(
    dgPointSpeedVector.Items[0], dgPointSpeedVector.Columns[3]);
dgPointSpeedVector.BeginEdit();


这篇关于WPF使特定列可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆