Toggle visibility of the tool bar in WPF Pdf Viewer

19 Aug 20211 minute to read

PDF Viewer supports showing and hiding toolbar, when you feel to customize the toolbar, you can hide the default toolbar of the PDF Viewer using the ShowToolbar property. The following code example hides the default toolbar in the PDF Viewer control.

// Hide the default (top) toolbar of the PDF Viewer
pdfViewer.ShowToolbar = false;
' Hiding the default toolbar of the PDF Viewer
pdfViewer.ShowToolbar = False

Hide the vertical toolbar

You can hide the vertical toolbar which is present in the left side of PDF Viewer by disabling all the items present in the toolbar. Refer to the following code to hide the vertical toolbar.

private void HideVerticalToolbar() 
{ 
	// Hides the thumbnail icon. 
	pdfViewer.ThumbnailSettings.IsVisible = false; 

	// Hides the bookmark icon. 
	pdfViewer.IsBookmarkEnabled = false; 

	// Hides the layer icon. 
	pdfViewer.EnableLayers = false; 

	// Hides the organize page icon. 
	pdfViewer.PageOrganizerSettings.IsIconVisible = false; 

	// Hides the redaction icon. 
	pdfViewer.EnableRedactionTool = false;   

	// Hides the form icon. 
	pdfViewer.FormSettings.IsIconVisible = false;
}
Private Sub HideVerticalToolbar()
    pdfViewer.ThumbnailSettings.IsVisible = False
    pdfViewer.IsBookmarkEnabled = False
    pdfViewer.EnableLayers = False
    pdfViewer.PageOrganizerSettings.IsIconVisible = False
    pdfViewer.EnableRedactionTool = False
    pdfViewer.FormSettings.IsIconVisible = False
End Sub

NOTE

The sample project for disabling top and left toolbar is available in the GitHub.