We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DataGrid FAQ 5.36 almost gets me what I want.

DataGrid FAQ 5.36 says, "How can I make my grid never have an active edit cell and always select whole rows (as in a browser-type grid)?". I downloaded the example project and this works great but, selecting multiple rows using the Shift and Ctrl keys doesn't work how you'd expect it to when click in the cells. This also seems to mess up the way the ctrl-click on the row hearder works for non-sequential multi-select. Here's what I'm trying to attempt to do: Make the selection functionality of a Datagrid work simular to that of the ListView in Details mode with FullRowSelect on. So I want to be able to click anywhere on a DataGrid Row and have it select the whole row, not just the clicked cell. On top of that I'd like to be able to hold down the shift key and have the Rows between my last selected Row and the current one get Selected. Simularily, I'd like it if holding down the Ctrl Key and clicking a row would simply at that row to the Selected rows. Any ideas how to do this?

1 Reply

CB Clay Burch Syncfusion Team May 8, 2002 06:18 AM UTC

You can still use a custom column style to handle the current cell not being active, but you cannot select/unselect the rows down in the override as with the single-select solution. Instead, subclass your datagrid, override OnMouseDown and change all cell clicks into row header clicks. Also override OnCurrentCellChanged and call the OnMouseDown from your override to simulate a click in the next currentcell to handle moving the currentcell with the keyboard. The above FAQ now has samples that implements a multi-select browser grid using these ideas. http://www.syncfusion.com/faq/winforms/search/856.asp

Live Chat Icon For mobile
Up arrow icon