.NET MAUI PDF Viewer Search Commands
The PDF Viewer for .NET MAUI provides the following commands related to Search feature:
-
OpenSearchViewCommand
(ICommand
)—Opens the search view UI for entering the search text. This command is intended for desktop. -
CloseSearchViewCommand
(ICommand
)—Closes the search view UI for entering the search text. This command is intended for desktop. -
NavigateToPreviousSearchResultCommand
(ICommand
)—Navigates to the previous search result. -
NavigateToNextSearchResultCommand
(ICommand
)—Navigates to the next search result.
Example
The following example demonstrates how to use the commands. The OpenSearchView
and CloseSearchViewCommand
commands are applicable on desktop, as they open the built-in search toolbar item for desktop.
1. Define the PDF Viewer control in XAML:
<Grid RowDefinitions="Auto, *">
<HorizontalStackLayout Spacing="10">
<Button Text="Open Search View" Command="{Binding OpenSearchViewCommand, Source={x:Reference pdfViewer}}"/>
<Button Text="Close Search view" Command="{Binding CloseSearchViewCommand, Source={x:Reference pdfViewer}}"/>
</HorizontalStackLayout>
<telerik:RadPdfViewer x:Name="pdfViewer" Grid.Row="1" />
2. Add the following namespace:
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
The following video shows the commands execution on desktop:
For the runnable PDF Viewer Search Commands example, see the SDKBrowser Demo Application and go to PdfViewer > Search > Commands.