Hi,
I've enabled my XamGrid with the following selection settings:
<ig:XamGrid.SelectionSettings> <ig:SelectionSettings CellSelection="None" CellClickAction="SelectRow" ColumnSelection="None" RowSelection="Multiple"/> </ig:XamGrid.SelectionSettings>
This is resulting in an unexpected side effect, where the grid now goes into multi-select mode whenever I click on a row in the grid, and as I move my mouse after the initial click, it just selects all the rows on the grid. Fortunately, using SHIFT and CTRL also lets me multi-select, but I *do not* want this click-drag selection featur. It's incredibly counter-intuitive, and does odd things when I overlay child windows over the grid window, for instance it keeps holding the selection and as I float my mouse over the child window (overlaying the grid window), the grid selection remains active.
Is there a way to disable this "feature"?
I noticed the following information on the Infragistics website (http://help.infragistics.com/Help/Doc/WPF/2012.1/CLR4.0/html/xamGrid_Selection.html):
It states:
With multiple selection enabled, your end users can select multiple cells, columns or rows in the following way:
So in clarification to my original post, the question is, how can I disable the click-and-drag multiple continuous selection? It is totally unwanted for my application, and only confuses the users very badly.
I figured out a hack fix, not very happy with it, since it's brute force and ugly to boot. If I preview the mouse move and force the release of the mouse capture, the click-and-drag selection problem goes away.
Sample code:
myXamGrid.PreviewMouseMove += MyHandler;
void MyHandler(object sender, MouseEventArgs e)
{
e.Handled = true;
(sender as XamGrid).ReleaseMouseCapture();
}
Please let me know if there is a more refined (i.e. elegant) answer!
Hi James,
unfortunately there is not build in way to disable the drag & drop continuous selection. I could not think of more elegant approach to disable it. However I could suggest a tune up to the approach.
The issue with releasing the capture every time the mouse is being moved over the XamGrid is breaking every capability of the XamGrid that is involved with drag& drop(i.e. column moving, column resizing, the column chooser drag&drop columns to re-arrange their position) So we basically need to restrict a bit the cases when we're forcefully releasing the mouse capture. We need to know the OriginalSource where the mouse button went down. Then in the PreviewMouseMove handler we traverse the VisualTree upwards until we get to the XamGrid itself or until we encounter a CellControlBase object. if the mouse left button went down over a cell we'll get the cellControlBase instance and using it we're able to track if it was a DataRow and if so that's when we need to relese the capture and mark the event handled.
Check out the attached sample.
If you feel that this is pretty common case and build in way should be provided feel free to submit product idea at http://ideas.infragistics.com/forums/192363-wpf
Hope this helps,
Hello James,
After looking into your requirement and doing some research, this functionality has been determined to be a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) at <http://ideas.infragistics.com>.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Thank you for contacting Infragistics.
Hi Konstantin, thanks for following up. I think that if the multi-selection options could be more fine-grained, it would solve my problems. I.e., I'd like to be able to disable the click-to-multiselect and click-and-drag-to-multiselect.
I am just checking your progress on this issue. Please do not hesitate to let me know if you have any further questions on this matter.
Regards,