Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1100
How to detect bulk selection changes
posted

I would like to detect when a user completes a range selection in a XamDataGrid using the mouse. I can detect individual selection changes but I only want to detect when a user has finished a range selection. For example. A user holds the CTRL key, mouse-down's on a record, drags the highlight across multiple records, and releases the mouse button (the mouse may be on or off the grid at this point). I tried LostMouseCapture, but the event gets triggered when the mouse leaves the grid but the button is still down.

Thanks.

Parents
No Data
Reply
  • 69686
    Verified Answer
    posted

    Hello,

    Have you tried the PreviewMouseLeftButtonUp event (either for the Window or the XamDataGrid itself)? It will fire even if you release the button outside the client area of the application window. There you can check for sender, OriginalSource, etc. to determine whether you have to consider this dragging/selection of records or not. You can also use this in combination with the PreviewMouseLeftButtonDown event.

Children