0

Problem

In my ContextMenuStrip when i hover the mouse on an item, it is selected (highlighted) - which is nice

Now I use up down arrow key and selects another item- It gets highlighted, which is also nice

But after that the selection again goes back to the previously selected item(the item selected by the mouse)

I need to persist the last selected item, which is either selected by mouse or by keys.

Could anuone plese suggest a way to handle it?

Any help is appreciated.

Background

I am attaching the ContextMenuStrip to the Customized data grid view.On right clicking on the header of the datagridview, the context menu is opened which lists the columns to display on the datgridview. Right click on the the items, to add to the grid.

Also can use the up and down arrow keys to select a column from the context menu and press enter to add it to the grid.

The grid is refreshed in particular interval, but the context menu is populated only once, that is in the constructor of the grid.

soms
  • 3
  • 2
  • What have you tries so far? – Sefe Jan 27 '17 at 11:23
  • I still have the problem.(I mean if the mouse pointer is on the context menu, the refresh of the context menu selects freshly again and it selects the item where the mouse pointer is on and the the selected item by the arrow keys are gone) – soms Jan 30 '17 at 07:50
  • Just FYI, I believe that's the default behavior for the ContextMenuStrip. – Jeff B Feb 02 '17 at 22:07
  • Thank you Jeff.But will there be any place(s) where I can override this behavior? Or I can't do this at all ? – soms Feb 06 '17 at 08:32

0 Answers0