11 Answers, 1 is accepted
We do not have a multiple redo control because most feature requests we get are for functionality that MS Word offers. As you may notice, there is no multiple redo control in MS Word either.
However, if it is a requirement of your project, you can create your own custom multiple redo control. All you should do is to create your own custom command that inherits from RichTextBoxCommandBase. Then, pass the number of redoes that you want to perform as a command parameter, and in ExecuteOverride method call:
int
undoStackIndex = Convert.ToInt32(parameter);
for
(
int
i = 0; i <= undoStackIndex; i++)
{
this
.AssociatedRichTextBox.Undo();
}
Then you must create your own control and implement the logic the way you would like it to work.
If you have a license for RadControls for WPF, you can download the source of the controls and take a look at the MultipleUndoCommand and MultipleUndoControl for reference.
Hope this answer your question.
Greetings,
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Best and thank you,
Steve
Steve
You don't actually need to access DocumentHistory class - instead you can just call the RadRichTextBox.Redo method as many times as you need it:
int redoAcationCount = 4;
for (int i = 0; i < redoAcationCount; i++)
{
this.radRichTextBox1.Redo();
}
If you have further questions do not hesitate to contact us again.
All the best,
Mihail
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Each time a character is typed, it counts as one undo or redo Typing action. With a limit of 20 actions each time the drop down is displayed, this is not a very good implementation. Just to undo the typing of the first sentence in this message would require 4 drop downs (60+ characters). Typing actions in Word are grouped together.
Rather than considering backspaces as Typing as it does in Word, each backspace is considered a separate Delete action.
So much of the Undo/Redo mechanism is private or internal. The only way I can see to modify the behavior to mimic that of Word, is to use reflection, clearly violating the spirit of OOD.
Since in your original response, you indicated that the intent was to provide the same functionality as Word, are there plans to enhance the undo/redo architecture to match that of Word?
Thanks,
Steve
Unfortunately there isn't any other way for you to implement multiple redo.
Regarding your question whether we planned to enhance this functionality, the answer is yes, we planned to implement the so-called smart undo which includes grouping of some commands of similar type. However, this task is not an easy one and has not been scheduled yet. I have created a PITS issue, which you can use to track our development plans: http://www.telerik.com/support/pits.aspx#/public/silverlight/10790
About the limitation of how much actions you can revert, this will depend on the performance of the commands contained in those actions.
Mihail
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Although I had to use quite a bit of reflection, it really wasn't that hard to implement and I was able to handle the multiple redo and grouping of the Typing actions. If you're interested, or anyone else is interested, I provided the source in the Code Library in the General and Integration Section under the title -
RadRichTextBox Multiple Undo/Redo
Thanks again for your responses,
Steve
Thank you for sharing your work with us.
We will review your code and will implement or modify it to fit our needs.
If you have other questions do not hesitate to contact us again.
Mihail
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Hello again,
Apparently the Undo/Redo implementation has been completely refactored in the Q1 2013 release. Classes that I made use of...
- HistoryAction
- HistoryCommandAction
have been removed breaking my current implementation of MultiRedo (see my previous post indicating that I posted the code in the Code Library). I have searched all over for documentation on the new..
- Undo/Redo Command grouping (assemble custom undo-redo actions)
feature. Could you provide or direct me to documentation on this new feature, and suggest a way I can refactor my own code to work with the Q1 2013 release?
Thanks in advance,
Steve
We refactored the internal commanding mechanism, which allowed us to expose some additional methods through the IDocumentEditor interface, enabling grouping of the execution of the IDocumentEditor's methods in undoable commands, for example:
// RadRichTextBox itself implements IDocumentEditor
IDocumentEditor documentEditor =
this
.radRichTextBox;
// You can also use RadDocumentEditor class, initializing it with any document;
//IDocumentEditor documentEditor = new RadDocumentEditor(this.radRichTextBox.Document);
documentEditor.BeginUndoGroup();
documentEditor.InsertTableRow();
documentEditor.InsertTableRow();
documentEditor.InsertTableRow();
documentEditor.EndUndoGroup(
"Insert 3 table rows"
);
// You can also cancel the execution of the undo group, and it won't be recored in the history.
//documentEditor.CancelUndoGroup();
All the best,
Boby
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.