Command Descriptors
RadPdfViewer's command descriptors are wrappers of its predefined set of commands. They were introduced as a way to easily enable/disable the commands based on the current document state. This comes in handy in the creation of UI for the viewer such as a toolbar, context menu, etc.
The CommandDescriptor class contains 2 public properties:
IsEnabled(Boolean): Gets or sets if the command is enabled.
Command(ICommand): The command to be executed.
Creating Custom Command Descriptors
The following section demonstrates how you can create a custom command along with the respective command descriptor.
This example creates a custom command by inheriting from the FixedDocumentViewerCommandBase class.
Further, you can create a respective command descriptor with the custom command and use it for the purposes of your application. This can be achieved in one of the following ways:
Create a class inheriting from the DefaultCommandDescriptors class which implements the default command descriptors and add a property of type CommandDescriptor to it.
Create a class inheriting from the CommandDescriptors class which does not implement the default command descriptors and implement them yourself.
The below snippet demosntrates how you can use the first of the mentioned methods of creating a command descriptor.
Once the custom command descriptors are implemented you just need to set RadPdfViewer's CommandDescriptors property.
Find a runnable project of the previous example in the WPF Samples GitHub repository.