views:

1053

answers:

5
+4  Q: 

Editable ListView

I am looking to create an editable ListView in a C# winforms application where a user may double click on a cell in order to change its contents. It would be great if someone could provide my with some guidance and/or an example. I am not looking to use any commercial products.

+3  A: 

You're asking the wrong question :)

A ListView is not the correct control. Use the DataGridView control. It can be configured to look just like a ListView, but it supports in-place editing of cells.

Simon Gillbee
That's a matter of opinion. The DataGridView doesn't always fit the use scenario or provide the required look-and-feel. However, it is a possible alternative, depending on the goals of the OP.
Jeff Yates
A: 

From the sounds of it, you might want to consider using the DataGridView instead.

DataGridView (MSDN)

jblaske
A: 

maybe this could help you:

msdn:How to create a ListView with Editable Cells

DaDa
This is a WPF article. Is that what is desired, or are we looking at straight WinForms here? The tags indicate WinForms.
Simon Gillbee
+2  A: 

An ObjectListView will do exactly that and much more. It is a wrapper around a normal .NET ListView. It is open source.

Its website has a Getting Started to help you begin, as well as a whole page devoted to cell editing

Grammarian
Thanks for your response. This custom control looks interesting, but may be overkill for what I'm trying to do. I shall experiment with it nonetheless.
transmogrify
Actually, it's not a custom control really. It's just a helpful wrapper around a plain ListView. But we won't tell anyone that :)
Grammarian
A: 

DataGridView is your friend SourceGrid is alternative

Pavels