We have a few pop-up menus (ContextMenu control) that appear via the right-mouse button.
Depending on the current logic state, we were hoping to enable/disable certain context menu items before it is shown.
To achieve this we are hooking the Popup event (“Occurs before the context menu is displayed” in description).
Unfortunatley, the context menu seems to appear and then the Popup even fires. Whilst the correct item state is then applied a second later (via the event handler) this does seem like a bug or some async event issue?
Regards,
Mark
Hi Mark,
After doing some more digging it won’t be possible to fix this issue because of how the browser shows the ContextMenu. We can’t intercept it before it shows it to the client.
To get around this issue, you’ll want to manually handle the showing/hiding of the ContextMenu, something like this:
Private Sub Window1_MouseClick(sender As Object, e As MouseEventArgs) Handles MyBase.MouseClick If (e.Button = MouseButtons.Right) Then MenuItem3.Visible = False ContextMenu1.Show(PointToScreen(e.Location)) End If End Sub
Hope this helps,
Levie
Hi Mark,
Thanks for reporting the issue! I’ve logged it as #2004.
I’ll keep you updated on the status of the issue!
Best,
Levie