This project is read-only.

Editing DataGrid Headers

Jun 30, 2009 at 10:28 PM

I think I've uncovered a problem trying to set an editor in a DataGrid header cell (to implement filtering). When trying to begin editing the DataGridCellController is causing an exception because it's firing a BeginEditRow call into the grid and then in turn into the DataSource itself. I think the BeginEditRow should handle not sending this onto the DataSource or the controller itself should not send this event for headers since the datasource (like BoundList) will fail with an index out of bounds exception trying to edit something not present.

To test it I removed the DataGridCellController (i know bad idea) and editing started fine. Since BeginEditRow isn't virtual (can't change) and I don't know that it's best to create a custom BoundList just for this I can't easily change this without jumping out to a custom DataGridCellController implementation that I add right after I remove the one added in the DataGrid constructor.

Am I missing something or is this indeed a problem?



Jul 1, 2009 at 6:42 AM

Could you send code, which would reproduce this issue?

Jul 1, 2009 at 3:46 PM

I've uploaded the sample code here:

If you right click on the right header it will fail. If you then open the SourceGridForm.cs and uncomment line 60 and rerun it will properly enter edit mode.

Hope this help.


Jul 2, 2009 at 10:14 AM

Thanks! this will help fix the bug :)

Jul 2, 2009 at 10:15 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.