Home Forums WinForms controls Xceed Grid for WinForms DataRow Event Handler Reply To: DataRow Event Handler

User (Old forums)
Post count: 23064

If a row has cells (like a DataRow), and you double-click the row, you’re actually double-clicking one of the cells. So the double-clicked cell receives the DoubleClick event. I see you’re initializing each DataRow after you add it. This is not necessary: you can set properties and events on the DataRowTemplate of the grid once, and each created DataRow will automatically be initialized like this. You could do it like this:<code>_grid.DataRowTemplate.ReadOnly = true;
_grid.DataRowTemplate.AllowCellNavigation = true;
foreach(Xceed.Grid.Cell cell in _grid.DataRowTemplate.Cells)
cell.DoubleClick += new EventHandler( Cell_DoubleClick );
private void Cell_DoubleClick(object sender, EventArgs e)
Xceed.Grid.Cell cell = sender as Xceed.Grid.Cell;
Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow;

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