WPF使特定列可编辑

编程入门 行业动态 更新时间:2024-10-22 11:38:06
本文介绍了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方法可帮助您使每个单元格处于自定义编辑模式.参考: msdn.microsoft/en-us/library/cc189733.aspx [ ^ ] 以下是负载处理程序中的示例代码: BeginEdit method of DataGrid class, helps you to make each cell in customized edit mode. Ref at: msdn.microsoft/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使特定列可编辑

本文发布于:2023-11-23 01:27:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619617.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编辑   WPF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!