Search code examples
c#visual-studio-2012objectlistview

ObjectListView Make Image clickable?


I'm using ObjectListView is there a way to make the image clickable or the object in the row clickable? So it works like a button


Solution

  • I found a way and that's to use CellClick.

      objectListview1.CellClick+= ObjectListview1_CellClick;
    

    Then the function uses HitTest to see column was pressed.

      private void ObjectListview1_CellClick(object sender, CellClickEventArgs e)
        {
            if (e.HitTest.ColumnIndex == 3) {
                //Code here 
            }
        }
    

    Hope this help anyone with the same problem