Removing a Tool from the Toolbar in Our MAUI Viewer

PSPDFKit for MAUI comes with a customizable main toolbar that, by default, includes a number of predefined items. You can remove any toolbar item you want using our API.

PSPDFKit is initialized with a default set of items that can be retrieved via MainToolbar.DefaultToolbarItems:

foreach(var item in MainToolbar.DefaultToolbarItems)
{
    Debug.WriteLine(item.Name);
}

To remove any item, first find the item you want to remove from the current toolbar items listed in the main toolbar, MainToolbar.ToolbarItems. Then update MainToolbar.ToolbarItems to remove the item:

// Find the item to remove.
var inkToggleButton = PSPDFKitController.MainToolbar.ToolbarItems.First(
    item => item.GetType() == typeof(InkToggleButton));

// Remove the item.
PSPDFKitController.MainToolbar.ToolbarItems.Remove(inkToggleButton);