Hosting WPF Python add-on in Winforms ElementHost

SyntaxEditor Python Language Add-on for WPF Forum

Posted 9 years ago by Bob Puckett
Version: 15.1.0622

Hello, I am evaluating Syntax Editor and the Python add-on for inclusion in our product solution. I have downloaded and installed the trial.  If the trial works, we will license immediately - we have a product schedule to meet.  (BTW, the product I am working on has been supporting Pascal and BASIC scripting for 15+ years - it is time to move on to something a bit ... fresher).

For various reasons, the application must run as a WinForms application.  I understand that the Python add-on is for WPF.

The editor needs to support multiple tabbed documents (similar to Visual Studio). My target, as others on he forum have also mentioned, is IronPython (because I need easy integration with C#).  I understand that the add-on does not support intellisense for imported DLLs.  That should be OK for my application.

My plan is to build a WPF user control, add the SyntaxEditor component, and hook up the Python Language add-on.  Then I could add the WPF user control to a Winforms user control using the ElementHost control.

Here are my questions:

  1. Is it possible to run the Python add-on in a WPF user control instead of a WPF application?
  2. Do you see reasons why hosting that WPF control in a Winforms User Control won't work?
  3. Can you give me any direction about where I might hook up the Ambient Parse Request Dispatcher using this scenario?
  4. If I get the Python add-on source, how much effort do you estimate to make it work with a Winforms control directly?
  5. What is the chance that you would provide a Winforms version of the Python Add-on?
  6. Do you have a standalone sample project for the Python Add-on?  I know that there is one in the sample browser, and I have looked at it, but is there a way to extract it into a separate solution so that I can monkey with it easily?

Thank you very much for your help.  I used SyntaxEditor years ago (2005 - 2010) for a custom langauge editor for another company and it was great.  I look forward to using it again - but with full Python support already done.

Comments (2)

Answer - Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Bob,

Thanks for taking a look at our products.  Let me answer your questions.

1) Yes, we have numerous customers who use our WPF SyntaxEditor and various add-ons in their WinForms apps.

2) We haven't done it much ourselves but plenty of customers have done it with success in their apps.  You could search the web for things like hosting WPF controls in WinForms to see if any common issues are listed for that scenario.

3) You'd still set that up in the app startup code.  That part is pure .NET anyhow (not WPF).

4/5) I don't think it would be feasible to convert SyntaxEditor and the Python add-on into native WinForms controls, even with source.  We would like to eventually backport our newer WPF-based API back to the WinForms version so that all 4 variations of SyntaxEditor could be on the same API, but it's a very large undertaking to do so.  Also the Python add-on is based on a newer grammar framework that was designed in the WPF version and doesn't have a counterpart in the WinForms version so there is no port coming to native WinForms unless we first backport the entire new SyntaxEditor API.

6) Sorry but the sample you saw is only available in the main Sample Browser.  Still, you should be able to copy the folder containing that demo's code out into a separate project, reference the assemblies, and it should pretty much be ready to run.

Actipro Software Support

Posted 9 years ago by Bob Puckett

Thank you.  I think that covers my questions really well.

I will head down he path of using the add-on in a WPF user control hosted in Winforms.

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.