views:

329

answers:

4

Hi ,

Can anybody help me with embedding controls in the listview. I need to add button controls as subitem of listview. thanks

A: 

There is a similar question on stackoverflow Adding button into a Listview in WinForms and the first recommendation is a codeproject article: Embedding Controls in a ListView

gyurisc
+2  A: 

Well, you could be talking about the Windows Forms ListView, in which case you're pretty much SOL (sh*t outta luck.) You can custom draw on the ListView but even that has limitations in Windows Forms.

Or you could be talking about the Windows Presentation Foundation ListView. In this case it's really quite simple. You can create a DataTemplate that you associate with the ListView's columnn. Here's an example.

Or finally you could be talking about the ASP.NET ListView control which also has data templating support but the implementation is a bit different from WPF. Here's an example of that.

Josh Einstein
+1  A: 

Use ObjectListView control which is opensource. It is excellent and is derived from ListView in Window.Forms.

affan
A: 

If you can use another control instead of a listview, try the DataGridView - you can add any type of control to a cell (subitem). http://msdn.microsoft.com/en-us/library/e0ywh3cz.aspx

Satanlike