With new design-time improvements to the PDFViewer and Spreadsheet controls in Telerik UI for WPF, you can get the full functionality of a document editing app, with clean XAML, in just a few clicks.
Traditionally, the startup experience of some of our document controls in Telerik UI for WPF - namely PDFViewer and Spreadsheet - was not as straightforward as we wanted it to be. While the RichTextBox has always sported a wizard for detailed customization of its UI, to get the nice-looking UI expected from an industry-standard document editor/viewer for the other two controls, you had to copy a bunch of XAML from one of our predefined examples, and then manually register some dialogs and format providers in the code-behind.
We worked hard to improve this, and you'll find the results in our latest release. You can now drag the PDFViewer or Spreadsheet controls from the toolbox and be presented with a convenient wizard dialog, which automatically generates simplified XAML code according to the chosen options. Neat, eh? :)
The experience for RadPdfViewer and RadSpreadsheet is wrapped up in these two gifs:
This means you can now get nice and clean XAML, providing the full functionality of a document editing app, with just drag-and-drop and a few clicks!
The XAML code contains the newly introduced PDFViewerToolbar and SpreadsheetRibbon controls. Despite being one-liners (instead of the previous thousands of lines!) they have an important advantage – when using them, you will automatically get all the new commands and buttons we add upgrading from version to version.
There are a set of simple properties in the form of HasSomething, which controls the visibility of the separate buttons. If you want fine-grained control on what's present in the toolbar though, the monolithic control may not be so convenient. In this case, right-clicking on the RadPdfViewerToolbar/RadSpreadsheetRibbon controls in the WPF designer now provides the "Replace with Editable XAML" command, which will "expand" the controls back to an editable XAML - which can be freely tweaked to match your scenario.
Similar to the context menu of the PDFViewerToolbar/SpreadsheetRibbon controls, we’ve provided an option to the PdfViewer/Spreadsheet themselves, which can be used to expand the default context menu of the controls. This means that, yes, we’ve included the context menu in the controls by default. It will no longer take up between 20 and 140 rows in your XAML, and any new features we add to the context menu will be shipped automatically to your application on each upgrade. If you want to make changes to the default menu, simply use the expand option to get editable XAML.
The need for a code-behind is completely eliminated – everything can now be registered and configured entirely in XAML. For the PDFViewer this means that its dialogs can now be added or removed by using attached properties. That pesky TextBox KeyDown event will no longer clutter your code-behind either. The format providers of the RadSpreadsheet can be registered simply by adding them to a collection of the control itself in XAML.
As a bonus, all the necessary references are automatically added to the project and you’ll no longer have to hunt for a list in the documentation.
We've also fixed some compatibility issues in the good old RadRichTextBox design-time generation wizard, ensuring that it works with all modern Visual Studio versions present – from 2017 Preview 2 back to 2010.
The team and I would love to hear what you think about the improvements to the Document controls in Telerik UI for WPF, so make sure to get the latest version and try it out.
Please, feel free to share your comments or suggestions in the Document Processing Feedback Portal. Quite frankly, your input is in the center of our future development, and thus any feedback on your end is warmly welcomed. :)
If you are new to Telerik UI for WPF, please head over to the product page to learn more about the toolkit and what the full offering has to give.
I hope you found this article helpful!
Borislav Ivanov is a software developer in the Telerik XAML team, working mainly on RadRichTextBox, and occasionally supporting team’s build infrastructure. He is passionate about his work, but also loves his vacations, when he can be found backpacking distant locations in Europe, Africa and Asia with his girlfriend.
Subscribe to be the first to get our expert-written articles and tutorials for developers!