New to Telerik UI for WPF? Download free 30-day trial

Find Dialog

RadPdfViewer allows flexible searching in a loaded PDF document. The following article describes the available search options, as well as how to use and customize the find dialog.

Other than the default needed assemblies, in order to take advantage of the Find dialog functionality in RadPdfViewer you need to add to your project a reference to Telerik.Windows.Controls.Navigation.dll.

Find Programmatically is described in detail in the Find article.

Using the UI

There are three possible input parameters that determine the results of the search:

  1. Regular Expression: Finds and returns entry of specified regular expression.

  2. Case Sensitive: Finds and returns all entries of a specified string taking into consideration case-sensitive. For example, you are going to find “AB” string, strings such as “aB”, “Ab” and “ab” would be ignored in the results.

  3. Whole Words Only: Finds and returns all entries of a given string which should be a whole word only (not a part of a word).

This is how the Find Dialog looks: Rad Pdf Viewer Find Dialog

Adding the FindDialog to a project

In a few simple steps the FindDialog could be added to a project.

First of all, it is obligatory to register a new find dialog. This can be done using the ExtensibilityManager.

Example 1: Register FindDialog using ExtensibilityManager

    ExtensibilityManager.RegisterFindDialog(new FindDialog()); 

If you prefer adding the dialog through XAML, you can use the RegisterFindDialog property of the RadPdfViewerAttachedComponents class.

Example 1: Register FindDialog in XAML

    <telerik:RadPdfViewer telerik:RadPdfViewerAttachedComponents.RegisterFindDialog="True" /> 

The ShowFindDialogCommand handles the opening of the find dialog. This command is bound to the Ctrl+F shortcut key combination (Apple+F for Mac) in RadPdfViewer.

Creating a custom find dialog

RadPdfViewer offers an easy way to create a custom find dialog which suits best to different user’s needs and desires.

In order to achieve this, should be created a class which inherits the IFindDialog interface with its ShowDialog method.

Example 2:Create custom find dialog

    public class CustomFindDialog : Window, IFindDialog 
    { 
        public void ShowDialog(FindDialogContext context) 
        { 
            // ... 
        } 
    } 

Find a runnable project showing this functionality in the WPF Samples GitHub repository.

See Also

In this article