Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27212

VS 2010 ContextMenuStrip opening in "wrong" place

$
0
0
I'm guessing this is glaring oversight on my part but I'm a bit stumped.

I have a ContextMenuStrip bound to a ListView. I also set the DropDown property of a DropDownButton (called ACTIONS) to be this ContextMenu as well so that I user can either right-click to get the Context Menu or, if they prefer, use the Actions button

The problem is that the very first time they right-click on an item in the Listview the context menu opens as if they'd clicked the Actions button (i.e. it opens the context menu below the Actions button). This only happens the first time though. Every other time they right click on the listview it opens the context menu in the correct location (i.e. over the listview itself).

If I remove the ContextMenuStrip from the DropDown property of the button and assign it code, like this
Code:

  Dim ActionsMenuItems As New ContextMenuStrip
  ActionsMenuItems = Me.ContextMenuUsers
 Me.ActionsDropDownButton.DropDown = ActionsMenuItems

then it works as expected. Is that the preferred method?

Viewing all articles
Browse latest Browse all 27212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>