如何与在WPF文本编辑列表视图? [英] How to have a listview with textbox editable in WPF?
问题描述
虽然我张贴这一点。我想,我可以使用一个数据网格。
While I'm posting this. I thought, I can use a datagrid.
是如此复杂创建一个列表视图编辑或者是更好地使用DataGrid?
Is so complex to create a listview editable or is better to use the datagrid?
推荐答案
这并不难,只需添加的 GridViewColumn
以<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.controls.gridviewcolumn.celltemplate.aspx\"相对=nofollow> CellTemplate
包含文本框
。
It's not that hard, just add a GridViewColumn
with a CellTemplate
that contains a TextBox
.
的 DataGridTextColumns
有点更简单但正如你只需要指定绑定
,而文本框
自动创建。你可以创建一个 GridView的
自定义类( GridViewTextColumn
),它做同样的事情,但。
The DataGridTextColumns
are a bit more simple though as you just need to specify the Binding
while the TextBox
is created automatically. You could create a custom class for GridViews
(GridViewTextColumn
) which does the same thing though.
这篇关于如何与在WPF文本编辑列表视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!