Some test text!
UWP / Guides / Config annotation tools
It is possible to customize the popup annotation menu on the viewer by adding or removing options when creating, selecting and editing annotations.
The sample code below shows how to replace the Delete button for a custom one by listening to OnShowPopupMenu
and checking the ShowingPopupMenuEventArgs
.
// Subscrive to OnShowPopupMenu event
ToolManager.OnShowPopupMenu += ToolManager_OnShowPopupMenu;
// Raised event
private void ToolManager_OnShowPopupMenu(PopupCommandMenu menu, pdftron.PDF.Tools.ShowingPopupMenuEventArgs eventArgs)
{
// Check if tool type is Editing Annotation
if (eventArgs.ToolType == ToolType.e_annot_edit)
{
// Check if annotation type is Square
if (eventArgs.AnnotType == AnnotType.e_Square)
{
// Find Delete button and remove it
menu.MenuItems.Remove(menu.MenuItems.Where(x => x.Tag.ToString() == "delete").FirstOrDefault());
// Create a custom button with a custom event/action
Button button = new Button();
button.Content = "Click Me";
button.Click += Button_Click;
/* It accepts a bool parameter that tells if should use
* default style or not on the newly added button */
menu.AddMenuItem(button, true);
}
}
}
private void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
// my actions
}
Default Menu Options | Customized Menu Options |
---|---|
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales