WPF window invoked from Excel, Context menu shows and disappears immediately

情到浓时终转凉″ 提交于 2019-12-10 10:59:58

问题


I have a WPF window which has a ItemsControl which contains list of User controls. Each user control has a button and a list box. On the button i have a context menu which lists some option.

When i ran the WPF window directly the context menu works perfectly. Now i have integrated the WPF form in a excel add in. on click of a button in addin the window show up. This works fine

But when the window is called from addin and i right click the button to see the context menu options, it comes and immediately disappears.

Any idea what i am missing here ?

  • Shankar

回答1:


I had an Excel-Add-In using WPF showing the behavior you describe. In my case it was a consecutive error of this framework bug:

https://connect.microsoft.com/VisualStudio/feedback/details/432998/excel-2007-vsto-custom-task-pane-with-wpf-context-menu-has-focus-problems

One of the recommended workarounds worked for me:

http://blogs.msdn.com/b/vsod/archive/2009/12/16/excel-2007-wpf-events-are-not-fired-for-items-that-overlap-excel-ui-for-wpf-context-menus.aspx



来源:https://stackoverflow.com/questions/7694125/wpf-window-invoked-from-excel-context-menu-shows-and-disappears-immediately

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!