Home Forums WinForms controls Xceed Grid for WinForms Button with image in grid Reply To: Button with image in grid

User (Old forums)
Post count: 23064

You don’t necessarily need a button. What you could do is this:
– create a class that implements the ICellViewer-interface and that paints a green checkmark if the value of the cell is 1 and a red X if the value of the cell is 0.
– set the CellViewer-property of the column to an instance of this class.
– catch the Click-event of the Cell on the DataRowTemplate, like this: grid.DataRowTemplate.Cells[“myCell”].Click += new EventHandler(cell_Click);
– in the eventhandler, convert the sender-argument to a Cell, and change the value of the cell from 0 to 1 or from 1 to 0.

To implement the ICellViewer-class, look in the Xceed documentation.

Imported from legacy forums. Posted by Tommy (had 231 views)