Writing to share one approach to making a WPF Window a child to the Rhino Window.
I have been working on a Rhino Plugin built with WPF and MVVM. The plugin uses a WPF window as the primary interface and I had been having issues keeping the window on top of Rhino. This was because the Rhino window is not a WPF window, and required some helpers to set the WPF Window’s
Owner Property to the Rhino window.
Below is one solution which is very simple but was tricky for me to track down on the web.
//Create Main WindowViewModel var mainViewModel = new MainViewModel(); //Create Main Window(WPF) with mainViewModel var mainWindow = new MainWindow(mainViewModel); //Create Helper to attach Rhino window(IWin32Window) as owner of Main Window(wpf) WindowInteropHelper helper = new WindowInteropHelper(mainWindow); helper.Owner = RhinoWinApp.MainWindow.Handle; //Open Window mainWindow.Show();
If there are any known issues with this approach, I’d certainly be interested to hear about them and the preferred approach.