Skip to main content
A newer version of this page is available. .
All docs
V21.2

Execute Document Viewer Commands

All Document Viewer commands implement the ICommand interface. To execute a command, call the command’s Execute method.

The following code invokes the Open dialog when the Document Viewer is loaded:

private void DocumentViewer_Loaded(object sender, RoutedEventArgs e) {
    documentViewer.Commands.ShowOpenDialogCommand.Execute(null);
}

A command’s CanExecute method returns if the command can be executed.

See the following documentation topic for information on how to customize the Document Viewer toolbar: Create a Custom Document Viewer Toolbar