Hiding text/comment annotation bubbles using PDFViewWPF?

We want to provide a toggle to turn annotation rendering on off, with the PDFViewWPF.SetDrawAnnotations function. We call it and it works fine, but if there happen to be comment popup bubbles for one or more annotations open, then they remain on screen, though the annotation they point to is not visible.

How do we close, or minimize, these dialogs?


The drawing of the text/comment bubbles is entirely in the PDFViewWPFTools project, so you need to make the following changes, and then make the call yourself to trigger.

  1. Add the following method to NoteManager.cs

internal void CloseNotes() { var tempDict = new Dictionary<Markup, NoteHost>(mActiveNotes); foreach (KeyValuePair<Markup, NoteHost> entry in tempDict) { CloseNote(entry.Key); } }

  1. In ToolManager.cs add the following method

public void CloseNotes() { NoteManager.CloseNotes(); }

Then in your code, call ToolManager.CloseNotes();