Development Dan's Blog

Annoying Context Menu bug in WinForms

by dan on Jun.12, 2007, under Development

Update: Wow, I’m really impressed with the response time of the triage team on Connect.  They acknowledged the bug same day and are already looking into a resolution.  That really is first class support.  Thanks guys!

Just ran into a rather annoying bug in WinForms.  You’ve got a ContextMenuStrip which is shared by a number of controls on your form.  When the user right clicks one of the controls, and chooses an item in the context menu, the SourceControl property of the ContextMenuStrip is supposed to be set to the control that you right clicked on.

This works fine if you have a flat context menu, but if your context menu has sub-menus, and you click one of those items, then the SourceControl property is always null!

If this bug affects or annoys you, please vote for it here:

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=282496

6 comments for this entry:

  • Charles

    I wonder if you can add the funtion of “stroll back into the original Vista form” so that once we want to have the back start up screen, it will be ok if we didn’t make a backup. Thanks

  • SY0-101

    Can you add function of scroll back and when you are going to fix that bug for sub menus i would like to visit you after my 70-642 Configuring Windows Server 2008 Network Infrastructure exam about which i’m confident to pass in first attempt as i have already pass my 646-204 CSE Cisco Sales Expert exam along with the 350-030 CCIE Voice exam with useful training material and all i have done with high score as i will be free from all this i must visit you to see what new things you are discussing.

  • Steve J. Laye

    Thanks for the information about the bug! Can the scroll back function into the original form of vista? Symtex are an expert database consultancy and development provider. We live, breath and eat Microsoft SQL Server and .Net programming day and night; really we love it and it’s that passion which keeps us at the top.

  • Mick Doherty

    I’ve voted, but this bug has been resolved as fixed even though it is still there in VS2010. Is it ever likely to get fixed? I can’t use any of the workarounds as I’m writing a custom renderer and so don’t have access to the Opened event of any ContextMenuStrip that might use it. Guess I’ll have to have another rethink about how I’m going to workaround another MS bug that I have no chance to fix and it looks like MS have no interest in fixing.

  • handychina

    thank you.http://www.efox-shop.com/Can the scroll back function into the original form of vista?

Trackbacks / Pingbacks

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...