We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use WPF SfRichTextBoxAdv control in Windows Forms application?

The SfRichTextBoxAdv control allows you to view, edit, and print rich text contents, and also import and export the Html, Xaml, Text files and Word documents (".doc", ".docx", ".rtf"). If you need to add rich user experience as like Windows Presentation Foundation (WPF) to your existing application is in Windows Forms, then it is more effective to embed one or more feature rich WPF controls to your existing Windows Forms application. You can host the Syncfusion SfRichTextBoxAdv WPF control to your existing Windows Forms application using ElementHost in Windows Forms.

 

The following sample demonstrates to host Syncfusion SfRichTextBoxAdv WPF control in Windows Forms application.

Sample

 

Please do refer the below MSDN reference link for more information about hosting a WPF control in Windows Forms application.

http://msdn.microsoft.com/en-us/library/ms742215(v=vs.110).aspx

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
5909 12/29/2015 12/29/2015 WPF SfRichTextBoxAdv 3.5
Did you find this information helpful?
Comments
Vincent Wendrzyk Feb 26, 2017

 The sample code was helpful.  Is there some way to implement a paste event handler on the wpf control  in the sample app - to check the paste contents prior to the operation being performed?

In the Form1_Load method, I've tried:

System.Windows.DataObject.AddPastingHandler(RichTextBoxAdv, PasteHandler);

and

RichTextBoxAdv.AddHandler(System.Windows.DataObject.PastingEvent, new System.Windows.RoutedEventHandler(PasteEventHandler), true);

The corresponding methods were as below, but no break point is ever hit in the handlers. 

        private void PasteEventHandler(object sender, System.Windows.RoutedEventArgs e)
        {
            var x = sender as SfRichTextBoxAdv;

        }

        private void PasteHandler(object sender, System.Windows.DataObjectPastingEventArgs e)
        {
            var x = sender as SfRichTextBoxAdv;
        }

Is there something special I need to do when the wpf control is hosted in winforms?  Or are only exposed events on the wpf control supported?


Thanks!


Reply
Vincent Wendrzyk Feb 27, 2017
Never mind, I'll submit an incident...
Reply
Arumuga Perumal S [Syncfusion] Feb 28, 2017

Hi Vincent,

Currently our SfRichTextBoxAdv control does not have support for Paste event. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Regards,
Arumuga Perumal S

Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon