Editing DataGrid Headers

Jun 30, 2009 at 9: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?

Thanks,

Sean

Coordinator
Jul 1, 2009 at 5:42 AM

Could you send code, which would reproduce this issue?

Jul 1, 2009 at 2:46 PM

I've uploaded the sample code here:

http://wideasleep.com/downloads/dropbox/SourceGridExample.zip

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.

Sean

Coordinator
Jul 2, 2009 at 9:14 AM

Thanks! this will help fix the bug :)

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