We can do this by using WindowInteropHelper. This can be done with the following code snippets.
[C#]
var wpfWindow = new MainWindow();
WindowInteropHelper windowInteropHelper = new WindowInteropHelper(wpfWindow);
windowInteropHelper.Owner = this.Handle;
wpfWindow.Show();
Note: While using the previous code in the form, add the following WPF assemblies to show the WPF window.
- PresentationCore
- PresentationFramework
- WindowsBase
Reference link: https://stackoverflow.com/questions/32701680/setting-a-form-as-owner-for-a-window
Share with