C#中:如何编辑在ListView项目和子项目? [英] C#: How do you edit items and subitems in a listview?

查看:184
本文介绍了C#中:如何编辑在ListView项目和子项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编辑在ListView项目和子项目?比方说,我有一个ListView与3列,子项,


汽车品牌|车名|年度车
福特|野马| 2000
道奇|充电器| 2007年

如何将项目添加像那样ListView和我将如何修改让我们说上有史以来指数[]行,如果我需要在运行时在事件烧制编辑的车名?


解决方案

如果你正在寻找一个的ListView 的内容就地编辑(专详细ListView的子项视图模式),你需要这个工具自己,或使用第三方控件。

在默认情况下,你可以用一个标准的ListView 达到最好是设置它的 LabelEdit 属性真正让用户编辑的ListView 的第一列文(假设你要允许自由格式的文本编辑)。

自定义的ListView 的的一些例子(包括完整的源 - code),允许就地分项编辑为:

C#的ListView可编辑的搜索
就地的ListView子项的编辑

How do you edit items and subitems in a listview? Let's say I have a listview with 3 columns,and subitems,

Car Brand | Car Name | Car Year
Ford      | Mustang  | 2000
Dodge     | Charger  | 2007

How would I Add items like that to listview and how would I edit let's say the Car Name on which ever row by index[] if I needed to edit at runtime at firing of an event?

解决方案

If you're looking for "in-place" editing of a ListView's contents (specifically the subitems of a ListView in details view mode), you'll need to implement this yourself, or use a third-party control.

By default, the best you can achieve with a "standard" ListView is to set it's LabelEdit property to true to allow the user to edit the text of the first column of the ListView (assuming you want to allow a free-format text edit).

Some examples (including full source-code) of customized ListView's that allow "in-place" editing of sub-items are:

C# Editable ListView
In-place editing of ListView subitems

这篇关于C#中:如何编辑在ListView项目和子项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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