This is a migrated thread and some comments may be shown as answers.

TxtDataProvider.StringChanged Event

1 Answer 45 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
WILLIAM
Top achievements
Rank 1
WILLIAM asked on 04 May 2016, 02:58 PM

The documentation for the TxtDataProvider shows a StringChanged event that is inheritied from DataProviderBase.  However, I cannot find this event to subscribe to it.  I need to know when the text has changed.  I have subscribed to the DocumnetOnChangedEvent, but this only fires if I'm typing into the control.  If I paste into the control, this event doesn't fire.  I would expect that it should, but it doesn't.  So I wanted to try the StringChanged event on the TxtDataProvider.

Where do I find this event (or some other event) that will notify me that the user has pasted content in the RichTextBox control.

I'm referencing Telerik.Windows.Documents in the project and the version is 2016.1.217.1050, which matches the version in the documentation except for .215 vs .217

Thanks for your help!!

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 09 May 2016, 09:50 AM
Hello William,

The StringChanged event is a protected method of the DataProviderBase class and could be accessed only by derived classes.

In order to achieve the desired goal, you could use the DocumentContentChanged event of RadRichTextBox - it will notify you when the users enter, paste or modify the styles of the document content.

Another option, which could help you track only the paste is to subscribe to the CommandExecuting event of the control and check whether the Command is a PasteCommand:
void radRichTextBox_CommandExecuting(object sender, Telerik.Windows.Documents.RichTextBoxCommands.CommandExecutingEventArgs e)
{
    if (e.Command is Telerik.Windows.Documents.RichTextBoxCommands.PasteCommand)
    {
    }
}

Hope this helps.

Regards,
Tanya
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
RichTextBox
Asked by
WILLIAM
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or