listviewitem

P

plork

hi all can anyone show me how i add a button to each row in a
listview?

i'm adding each row like this but i need to add a button as well

lv = new ListViewItem(id);
lv.SubItems.Add(xx);
lv.SubItems.Add(yy);

m_lstView.Items.AddRange(new ListViewItem[] { lv });

when i do AddRange i need to add a button, can anyone help me out
 
N

Nicholas Paldino [.NET/C# MVP]

Short form, you can't.

You could handle custom painting for the ListView, painting your
buttons, responding to user input, but quite frankly, that's going to be a
massive PITA. You don't want to do this.

There really isn't a good way to do this. I'd look into another way of
trying to accomplish what you are doing.

If you were using WPF (which I am pretty sure you are not), you could
place the buttons into the ListView easily, as WPF supports composition at a
fundamental level.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

memory issuse with listview control? 1
ListViewItem 10
Hiding/Closing ContextMenu 1
Listview help 1
Listview problem 1
code reuse 1
Listview cannot add listviewitem 1
Listview icons - how to extract icons to hdd? 2

Top