I am developing a VSTO application with a WPF Window added to the Application. I want to make WPF window to stay on top only for the Excel file that it was triggered from. I made WPF window TopMost=True and it is staying on top of all other applications running Then I tried this
mw.Owner = new WindowWrapper((System.IntPtr)Globals.ThisAddIn.Application.Hwnd);
But it is giving an error. Can someone help here please
System.InvalidOperationException: 'Cannot set Owner property to a Window that has not been shown previously.'