Our Telerik UI for WPF and UI for Silverlight suites have a new feature - the Format Painter. Learn the functionalities and APIs it supports, and how it will help the end-users of your applications to perform in-app image editing.
With the R2 2018 release of our Telerik .NET tooling for WPF and Silverlight, the newest addition to the features of the RadRichTextBox is the Format Painter, which allows the easy transfer of formatting from one place to another in the text. You can see it in action below:
How to Use the Format Painter
It's simple to use the Format Painter. Clicking the button once will copy the current formatting under the caret and it will be pasted on the next selection. After this, the format painter is disabled and will not paste further. Double-clicking the button will once again copy the formatting, but it will be pasted as many times as necessary, on each subsequent selection, and the user will have to manually deactivate it.
The Format Painter is smart enough to make subtle changes to the copied formatting when pasting, in order to adapt to the current context. For example, if the selection you are pasting on does not contain an entire paragraph, the properties of a paragraph style may be copied as character properties. For another example, when you copy from a place which has only the normal style, the target text will have its properties cleared, instead of having new ones applied on top of the old ones.
The power users of your rich-text apps may also find the two new associated keyboard shortcuts useful: Ctrl+Shift+C for format copying, and Ctrl+Shift+V for format pasting.
New Format Painter API
If you would like to use the Format Painter programmatically, you can do this most easily using the IDocumentEditor interface, which is implemented by both RadRichTextBox and RadDocumentEditor (for UI and for non-UI related scenarios, respectively). It exposes two self-explanatory methods:
CopyFormatting – copies the formatting of the current selection
PasteFormatting – pastes the currently copied formatting on the current selection
The upper methods don't affect the state of the UI button. If you would like the button to reflect what you've done programmatically, you can use the
ChangeFormatPainterState command, which can be found in RadRichTextbox.Commands. The parameter it expects is of type
ChangeFormatPainterStateCommandParameter which can be as follows:
CopyForSinglePaste – The format painter copies the current formatting and prepares to paste it once
CopyForMultiplePaste – The format painter copies the current formatting and prepares to paste it in multiple places
Cancel – The format painter cancels pasting
What the Future Holds
We hope you'll be as happy with the UI and API functionality of the Format Painter as we are. In the next release (R3 2018), we've planned something small but very useful for the RadRichTextBox, the SYMBOL field implementation. It will allow problem-free pasting of text with symbols created in and copied from MS Word. As one of our flagship WPF controls, we are continuously investing in the quality of RadRichTextBox, so expect a ton of fixes and small improvements as well.
And don't forget that our roadmap is heavily dependent on your requirements. Make sure to review the items in the Telerik UI for WPF feedback portal, and cast your votes and/or log your specific requests.
If you are new to Telerik UI for WPF and Silverlight, or this is the first time you are hearing about the suite, you can check out the webpages for WPF and Silverlight, download a trial to try them out for yourself and visit the documentation to get a hang of how they work.
Start your trial today: UI for WPF UI for Silverlight
Thank you and happy coding!