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

Stop document history - coloring document text

1 Answer 24 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 20 Sep 2013, 02:26 PM
Hi,

is there any possibility to stop history? In my case user writes into the radrichtextbox. If he writes some word/phrase, event DocumentContentChange is thrown and I make at this point something like:
Go throw the document and try to find "my" (from dictionary) words - set CaretPosition on the beginning of the document and then go step by step, word by word throw the document, setting selectionstart and selectionend and getting words from selection. If word is in my dictionary, set its foreground color.
After setting text foreground of whole document, colors are as shoud be. But problem is, that user cannot use undo/redo, because in history there are all selections used for coloring foregrounds. I need to make something like History.Stop()/Start() or finally set history from the beginning (but there is no setter).
Any idea how to work better with history? Any better solutions for my case? Maybe I shoud set foreground somehow a better way...

Thanks so much for help.

1 Answer, 1 is accepted

Sort by
0
Accepted
Petya
Telerik team
answered on 20 Sep 2013, 03:35 PM
Hello Richard,

Disabling the document History is fairly simple using the IsEnabled property. Additionally, you can group several actions in a single undo group in the manner demonstrated here or simply clear the history.

On a side note, traversing the whole content of a document on each change might cause some performance diminishment. If possible I'd suggest you revise this logic. 

I hope this helps! Let me know if you have other comments or questions.

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RichTextBox
Asked by
Richard
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or