I am using a regular gridview to display data from dataset
I select multiple rows using the row header. I then right click against a row that is NOT within the selected rows and the focused row moves to the row that was right-clicked and loses the selection against the originally selected rows. This is different to the windows.forms.datagridview behaviour and I need to keep the rows selected. I have noticed that if I select multiple rows and right click against any one of those rows then the row selection is kept, which is fine but that is not what I need to do.
I am handling PopupMenuShowing event and display a popupmenu. I thought it might be because I was using popupmenu instead of using DXMenuItem but I found a sample that was using that and it still behaves in the way that I don’t want it to.
http://www.devexpress.com/Support/Center/Question/Details/Q388517
run this sample
select rows 0,1 and right-click on row 3
the focused row is now row 3, I don’t want the focus to change, I want to be able to invoke the context menu on row 3 and keep rows 0,1 selected
If it helps, to explain why I need to do this, I want to be able to select items and then click on another item and say “group selected items with the item I have just right-clicked on”
Really hoping we can find a solution for this one. I don’t really want to go down the road of using checkmarks to select items as it is converting an existing application that uses windows.forms compoenents and I want to keep functionality as close as possible to the original
Hello,
Just wanted to drop you a note to let you know that I need a bit more time to finish working on my answer to your inquiry. Thanks so much for your patience.
Hello,
I have created a sample which demonstrates how to keep row selection when you right-click an unselected row. Please try this solution and inform us about your results. The main idea is to use the GridView.GetSelectedRows and GirdView.SelectRow methods.
We are looking forward to your reply.
hi alexey, thanks for the solution and the interim update to say it was in progress.
i did actually put something together myself that did roughly teh same thing but i wanted to see what you guys could come up. Your solution is slightly more polished than mine and it looks to be working well.
i cant see the buttons to mark as solution
Hello,
I am glad to hear that my assistance was helpful to you. Feel free to contact us if you have further questions.
I must note that you cannot mark this comment as a solution since it is a comment, not an answer. For now, I have moved this comment to the Answer section. You can mark the answer as a solution.