listviewitem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • plork

    listviewitem


    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


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: listviewitem

    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.

    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "plork" <plork123@hotma il.comwrote in message
    news:2cf75f32-9bc9-4ad6-95e8-4b9d93d6640f@s8 g2000prg.google groups.com...
    >
    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
    >
    >

    Comment

    Working...