Stop document history - coloring document text

2 posts, 1 answers
  1. Richard
    Richard avatar
    2 posts
    Member since:
    Jul 2013

    Posted 20 Sep 2013 Link to this post

    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.
  2. Answer
    Petya
    Admin
    Petya avatar
    975 posts

    Posted 20 Sep 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top