Does anyone know of a working example for putting the WPF syntax editor in a winform? I've searched all over, and even chatGPT, but it can't provide a working example.
Thank you for contacting Infragistics. This is documented on MSDN
After you've added the assemblies for the XamSyntaxEditor, adding the component to a Windows Forms project is fairly straightforward.
public partial class Form1 : Form
private ElementHost _ctrlHost;
public XamSyntaxEditor syntaxEditor;
public TextDocument document;
_ctrlHost = new ElementHost();
syntaxEditor = new XamSyntaxEditor();
_ctrlHost.Child = this.syntaxEditor;
document = new Infragistics.Documents.TextDocument();
syntaxEditor.Document = document;
_ctrlHost.Width = 800;
_ctrlHost.Height = 450;
Let me know if you have any questions.
Thanks, that did the trick. One more thing... I'm trying to use it as a sql parser and I'm using the code on this page...
Supported Languages - Infragistics WPF Help
syntaxEditor.Document.Language = TSqlLanguage.Instance;
But it tells me...
Cannot resolve symbol 'TSqlLanguage'
I'd also like to show line numbers.
I get the following warning in Visual Studio, and when I rebuild the solution I get two errors
Because the app won't recompile I get the following error prompt on run.
Ok, I just uploaded a new version. If you run ConnParameterQB you should get the error at hand and not all the others.
The new app runs fine without errors. Just make sure to include all the assemblies. I noticed you've been mixing WPF4 and the versionfree assemblies.
For context here is what I did, I added the WPF4 syntaxeditor dll and removed the version free ones and everything ran without errors.
Dude, it totally works now. Thanks for taking the extra time on this one.