MFC Wpf interop issue - context menu from wpf cannot work RRS feed

  • Question

  • Hi,

        There is a strange problem in MFC and wpf interop. Here is the my environment. I have a pane derived from CDockPane, and inside the pane there is a Page derived from CMFCPropetyPage, and inside the page there is also a CWnd instance to host a wpf edit control (user control + TextBox), by using C++/cli. When I right-click the context menu of the pane, and before the closing the menu, try to right-click or left-click the textbox, the wpf control cannot work. The focus seems to be out of control. I just find out this is a common issue for wpf control in MFC. Anybody run into such problem?How to solve that? Anyone interest in it, I can share the codes, please give me the email.

    Thanks in advance.

    • Edited by LittleBoy2 Wednesday, April 18, 2012 6:37 AM
    Wednesday, April 18, 2012 2:01 AM

All replies

  • I'm not sure mixing WPF and MFC is a good idea. I've tried that a
    couple of years ago, and stopped it.
    Wednesday, April 18, 2012 5:20 PM
  • Probably you are right. But there is no options for the solution, I have to resue its .net functionality in old product, which is written in C++.
    Thursday, April 19, 2012 1:37 AM
  • check this link this may help you out

    Thursday, April 19, 2012 8:47 AM
  • Thanks for the link. But it could not help solve the problem and probably there is too little information on that issue. how to put a attachment here?so that I can share the sample codes. I am very sure the problem is not in wpf side, and it is in MFC application side. My problem only can be reproduced easily after showing context menu (called by CContextMenuManager::TrackPopupMenu(..)) in MFC framework and click the wpf edit control to close the context menu. and then the wpf control cannot work, including its context menu.
    Thursday, April 19, 2012 3:37 PM