I want to port a tool developed in ArcObjects for ArcMaps into ArcGIS Pro using the ArcGIS Pro SDK.

The tool's UI was created using WinForms but to recreate the UI in ArcGIS Pro is looks like I would need to use WPF.

I have seen generalized .NET posts online saying that is possible to embed WinForms inside WPF. What I want to know is if it is possible to do so in ArcGIS Pro.

I have not found yet any references or samples of anyone having done it before.

  • 2
    Have you tried anything yet? I'd be surprised if it wasn't possible to just use var f = new MyWinForm(); f.Show();. Dockable windows may be harder though. It looks like you'd need WindowsFormsHost to do that: docs.microsoft.com/en-us/dotnet/api/… – Berend Nov 23 '18 at 7:52
  • I was able to use win forms within a Pro code-base. The use-age / coding is the same as any *.Net project. However I did not try a dock-able window. This approach though easier when porting code, it misses the "goodness" of the wpf approach. The wpf form controls have some extra functionality e.g. it is easy to change the background colour of a list item in wpf listbox. – TazAstroSpacial Jul 20 at 7:37

It is technically possible and doable, but building the new ArcGIS Pro .NET Add-in on WPF is the way to go for ArcGIS Pro customizations.

If you are set on embedding WinForms in WPF, you'll use the WindowsFormsHost control.

Below are links to articles and walkthroughs that describe developing for ArcGIS Pro using WPF and MVVM, as well as what you need to do if you are planning to embed WinForms inside of WPF controls.

ProConcepts Migrating to ArcGIS Pro https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Migrating-to-ArcGIS-Pro

ArcGIS Pro SDK for .NET: Intro and Pro Add-in Programming Pattern http://proceedings.esri.com/library/userconf/devsummit-euro17/papers/devsummit-euro_38.pdf

ArcGIS Pro SDK for .NET: UI Design and MVVM http://proceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1853-255.pdf

WPF and Windows Forms Interoperation https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/wpf-and-windows-forms-interoperation

Walkthrough: Hosting a Windows Forms Control in WPF by Using XAML https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf-by-using-xaml

Walkthrough: Hosting a Windows Forms Composite Control in WPF https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-composite-control-in-wpf

WinForms and WPF: An Integrated Approach https://www.slideshare.net/talentica/winforms-and-wpf-an-integrated-approach

How do I host a Windows Forms control in a WPF application ? https://www.syncfusion.com/faq/929/how-do-i-host-a-windows-forms-control-in-a-wpf-application

| improve this answer | |

While I'd encourage you to port your code to use WPF, I don't see why you couldn't just host your WinForms control inside a WPF view. To ArcGIS Pro it's then still just a WPF control - it doesn't really care what's deeper down the UI Hierarchy (because there's no way it can care)


| improve this answer | |

I was looking at the same process for translation from ArcObjects to Pro SDK. I found the learning curve for WPF too steep for the time I had.

A few tests with ordinary Winforms revealed it worked ok. There was no need to embed the forms in a WPF view.

The translation was completed with WinForms and it works fine. When I have more time I'll update the forms to WPF.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.