I've been trying to debug this for well over an hour. We did have one bit of code that moved focus when the buttons were in a ContextMenu and that was causing the menu to close. However after I wrote some code to resolve that, I found it was still closing on clicks.
When I put a breakpoint on the ContextMenu.Closed event, all I can see is that the internal popup was closed but I'm not able to determine what exactly is triggering it. I put breakpoints in everything I can think of in our code that would move focus, and none of them hit, so it's likely something in Microsoft's code that is getting triggered. I'm not sure what else to try unfortunately.
Note that everything stays open fine if the root element is not a ContextMenu, so it works when in the ribbon. For some reason some internal MS ContextMenu code is causing this.
[Modified at 08/03/2009 03:16 PM]