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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Customized row selection behavior in DataBound grid

Thread ID:





7586 Oct 1,2003 04:59 PM UTC Oct 9,2003 03:13 PM UTC WinForms 2
Tags: GridControl
Gene Gorokhovsky
Asked On October 1, 2003 04:59 PM UTC

I need to implement the following customized selection behavior: 1) single click on row header column selects/unselects row (as in ListBoxSelectionMode == SelectionMode.MultiSimple 2) clicking on a non-row header column does not affect selection I attempted to achieve this by setting SelectionMode to MultiSimple, handling SelectionChanging and canceling selection if user clicked outside the row header column, but both CurrentCell and MouseDown location are apparently not yet set when SelectionChanging is fired. What would be the alternatives to try? Gene Gorokhovsky DataBoundGrid v

Administrator [Syncfusion]
Replied On October 3, 2003 02:36 PM UTC

It looks like you completely want to override the default selection behavior. In that case I suggest disabling the MouseController that handles mouse selections. Do that with Grid.Model.Options.ControllerOptions &= ~GridControllerOptions.SelectCells; Now that you have turned off default selection mechanism you can add your own cell selection logic by handling the CellClick event and setting/resetting with SelectRange calls. If that is not good for you need to take a close at the SelectionChanging event. One of its args is a reason. There you can try cancelling resetting selection, adding selections etc. But you have to take a good look and add some Trace output when this event is called. Not sure if it will get you all the way to what you want to implement but also worth a try. Stefan

Gene Gorokhovsky
Replied On October 9, 2003 03:13 PM UTC

I was able to implement required behavior by checking Cursor.Position in SelectionChanging, and canceling it when cursor is not over row headers. CurrentCell did not work because it is set after SelectionChanging fires. Thanks, Gene


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon