How can i prevent the right click from selecting an item in my listview both in click and double click?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use this code, I think it should do the work. You need to set some
boolvariable to indicate that the right mouse has been clicked in yourMouseDown, thenClearselected items, if SelectedIndexChanged event handler fired because of the right click and then reset the indicator onMouseUpevent. Check the code:EDIT: This is the best I could do, it preserves the selection but flickers. the solution could be implemented using some custom drawing of the items but that requires too much time. I leave that to you.