I am opening the WPF window with single combobox from an MS Excel add-in (VSTO) Ribbon button. The issue is that in random windows environments upon click on combobox the dropdown selection options are shown in front of excel while the window itself get hidden behind it. Once, selection is done the WPF window is shown infront of excel again. If I remove the owner of window then both, combobox and window, are showing properly however I am loosing the effect of current window to stay permanently in front of current Excel window. Again, I would like to point out that in most environments the bellow code is working fine except for windows 8 and occasionally in virtualbox hosted windows7. Any ideas what is wrong with my approach?
var thread = new Thread(() =>
{
var wpfWindow = new WPFWindow();
var ownerWindowHandle = (IntPtr)Globals.ThisAddIn.Application.Hwnd;
var helper = new WindowInteropHelper(wpfWindow);
helper.Owner = ownerWindowHandle; // COMMENT THAT AND IT WORKS PROPERLY
wpfWindow.Show();
wpfWindow.Closed += (sender2, e2) => wpfWindow.Dispatcher.InvokeShutdown();
Dispatcher.Run();
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();