Modality between mfc and hosted wpf

I place a WPF window inside an MFC application. I use WindowInteropHelper to set the owner of the WPF window to the main MFC window of the application. The problem is that I am trying to create and show a modal dialog box in the main application with CDialog :: DoModal, it is only modal for the MFC window.

Interestingly, MessageBox has an MB_TASKMODAL style that works fine with a WPF window, but I can't find anything like it for CDialog.

I currently have a workaround that gets the WPF window handle through WindowInteropHelper and sets it as the parent dialog, and then manually turns the MFC window off and on again before and after calling DoModal, but it's an ugly hack.

Has anyone else encountered this issue of hosting WPF before this?

+3
source share

All Articles