Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

Popup Annotation

A Popup annotation displays a pop-up window containing text associated with a parent annotation, such as a Text, Line, TextMarkup or Stamp annotation. When closed, a popup annotation is invisible. When open, it should appear as a pop-up window at a specified location on the page.

The PopupAnnotation class is a derivative of the Annotation class and it exposes the following properties:

Property Description
ParentAnnotation Gets or sets the parent MarkupAnnotation that this popup is associated with.
IsOpen Gets or sets a value indicating whether the popup is initially open.

Creating a PopupAnnotation

Popup annotations are typically created in association with another markup annotation, such as Text, Line, TextMarkup or Stamp. The following example shows how to create a PopupAnnotation associated with a TextAnnotation:

RadFixedDocument document = new RadFixedDocument();
RadFixedPage page = document.Pages.AddPage();

TextAnnotation textAnnotation = page.Annotations.AddText(new Rect(100, 100, 200, 200));
textAnnotation.Contents = "Test text";

PopupAnnotation popupAnnotation = page.Annotations.AddPopup(textAnnotation);
popupAnnotation.IsOpen = true;

The popup annotation will display the contents of the text annotation in a pop-up window.

Creating a PopupAnnotation with FixedContentEditor

When creating a TextAnnotation with the FixedContentEditor's DrawTextAnnotation method, you can also associate a popup annotation by setting the addPopup parameter to true:

RadFixedDocument fixedDocument = new RadFixedDocument();
FixedContentEditor editor = new FixedContentEditor(fixedDocument.Pages.AddPage());

editor.Position.Translate(100, 100);
Size annotationSize = new Size(50, 50);
Size popupSize = new Size(250, 100);
string text = "This is a TextAnnotation";
bool addPopup = true;

editor.DrawTextAnnotation(annotationSize, popupSize, text, addPopup);

// Access the created popup annotation if needed
PopupAnnotation popupAnnotation = fixedDocument.Pages[0].Annotations[1] as PopupAnnotation;

This code creates a TextAnnotation with an associated PopupAnnotation. The popup will display the text provided in the method call.

See Also

In this article