Home Forums WinForms controls Xceed Grid for WinForms DoubleClick Reply To: DoubleClick

User (Old forums)
Member
Post count: 23064

What you need to do is to subscribe to each cell DoubleClick event through the DataRowTemplate, before fill the grid with data, so the template used to create each cell in the gird has this event attached to it.

i.e.:

private void Form1_Load(object sender, EventArgs e)
{
gridControl1.ReadOnly = true;
foreach (Cell cell in dataRowTemplate1.Cells)
{
cell.DoubleClick += new EventHandler(cell_DoubleClick);
}
}

Then in the event handler, the sender will be the cell, so you simply need to cast it to a cell, and get its ParentRow to get the DataRow that was clicked.

i.e.:

private void cell_DoubleClick(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine( ( ( Cell )sender).ParentRow.ToString() );
}

Imported from legacy forums. Posted by André (had 2978 views)