0

Currently, I have a WPF application (.NET Framework 4.7.2) that references 3rd party assemblies containing WinForms controls (.NET Framework 4.7.2). The WPF application utilizes some of those WinForms controls in its user interface. This is achieved by hosting the WinForms controls in System.Windows.Forms.Integration.WindowsFormsHost on the WPF user interface. This approach works but requires that the WPF application directly references the WinForms assemblies and loads them when the WPF application is starting.

Now, the assemblies containing the WinForms controls are part of a standalone application. I'm wondering whether it would be feasible to build the user interface of the WPF application by getting the WinForms controls from another process instead of directly referencing the WinForms assemblies.

So, the scenario would be that the WPF application first spawns a new process running the WinForms application. It would then somehow access the WinForms controls from that external process and show them in its own user interface. Can this be achieved with the .NET Framework 4.7.2?

Felix D.
  • 4,811
  • 8
  • 38
  • 72
ackh
  • 1,648
  • 2
  • 18
  • 36
  • you can load any dll at runtime (give the fileaccess is possible (not locked by the running process)). I don't see why that should not be possible. See [this](https://stackoverflow.com/a/36431341/4610605) to get started. – Felix D. Nov 08 '22 at 08:54
  • @FelixD. But then the result would still be the same, i.e. the dll would be loaded into the WPF application process. The WPF application process would not access the Winforms application process. – ackh Nov 08 '22 at 09:55
  • So just to be clear - you want to embed a usercontrol of a running app (including data or whatever is displayed) into your app ? Maybe have a look at [this one](https://stackoverflow.com/questions/5028598/hosting-external-app-in-wpf-window) instead. hope it helps! – Felix D. Nov 08 '22 at 11:47
  • @FelixD. Correct, that is the idea. – ackh Nov 09 '22 at 08:41

0 Answers0