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

OnRowEnter and Selection

Hi I'm using a derived class of gridDataBoundGrid in multiselection rows mode. I'm overriding OnRowEnter method. When I'm selecting a row with the mouse I get in the Selections property the right row. When I'm moving the selection with the key up / down arrows the Selection property is empty. When I'm selecting multirows with the mouse the Selection property has all the rows. If I do the selection with the keyboard I get in the Selection property the rows that were selected before the keyboard event and not the new rows. Is this a bug ? Is there another method I can override that has the same values for Selection for mouse events and for keyboard events ? when I was registering to grid.model.SelectionChanged I got the event more than once for each selection ? Thanks Asaf

7 Replies

TH Thomas October 1, 2003 01:14 PM UTC

Hi Asaf The Model.SelectionChanged event is raising at least twice, because of the deselect of the old row and the select of the new row. Im using this event to build an internal list of the selected DataRows and it works for me. Regards Thomas


AD Administrator Syncfusion Team October 1, 2003 01:50 PM UTC

Hi Asaf, there are some internal differences the way selections are added/removed between keyboard and mouse action. But you should have all the information you need be provided by the SeclectionChangeXXX events. Make sure you do also check the GridSelectionReason of the event to handle the different scenarios that caused the event to be raised. Stefan


AS Asaf Segal October 2, 2003 12:39 AM UTC

So when should I use RowEnter ?


AS Asaf Segal October 2, 2003 05:48 AM UTC

I checked the reason property of the selection changed event. This event occurs number of time and not the same number in different situations. Is there a way to know what is the last selection changed event ? ( I draw the selected objects in the grid and I get flickering because of the selection changed events that happend before the last one in each selection ) I had an idea of catching the mouse up and key up events, then I figured that I need also the mouse move event. I didn't find a way to get the "last change" when the arrow keys are pressed continuesly so there is no key up event until the end of the selection


AD Administrator Syncfusion Team October 3, 2003 02:41 PM UTC

You could cache the eventargs of the last SelectionChanging or SelectionChanged event in a field in your class and then check that field in the next SelectionChanging event. Does that help? Stefan


AS Asaf Segal October 7, 2003 01:49 AM UTC

Sorry, but it doesn't. I need to know of a new selection that came from the mouse or from the keyboard, and I don't want to get more event than I need. My applications draws objects in a window, according to lines that are selected in the grid. I don't care which event or events I should catch but I want to know that the selection operation has finished so I can redraw the window. I want the window and the grid to be syncronized so if the user is draging the mouse on the grid, or continuesly pressing down key, operations that makes the selection graw, without key up / mouse up events, I still want to know that I should redraw the window. Thanks Asaf


AD Administrator Syncfusion Team October 7, 2003 09:53 AM UTC

If you create a sample application and add comments that explain in which scenarios the eventargs (please give instructions how to reproduce) passed to SelectionChanging are not detailed enough I'll take a look and debug into it. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon