> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/xamarin/annotation/annotation-list.md).

# Annoatation list

Learn how to view annotations as a list in Xamarin.Android with AnnotationDialogFragment. Set up listeners, manage read-only access, and more. Explore the Xamarin.iOS equivalent for PTAnnotationViewCo

Annoations can be viewed as a list in this UI component

{% tabs %}
{% tab title="Android" %}

## View annotations as list in Xamarin.Android

{% hint style="info" %}
**This tutorial only applies to Xamarin.Android. See Xamarin.iOS equivalent here .**
{% endhint %}

The [`AnnotationDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.AnnotationDialogFragment.html) displays a list of all annotations in a document being viewed by a [`PDFViewCtrl`](https://sdk.apryse.com/api/xamarinandroid/pdfnet/api/pdftron.PDF.PDFViewCtrl.html). The list also contains any comments that have been added to the annotations.

![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-47fffd5031d4592a346729695d0f7ad798a72552%2F8deb824fe864a598e715847f2700a0e82ce82401-1080x2160.png?alt=media)

## Show annotation dialog

To show an annotation dialog fragment in your activity, create a new instance of [`AnnotationDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.AnnotationDialogFragment.html) by calling `newInstance()` and setting the [`PDFViewCtrl`](https://sdk.apryse.com/api/xamarinandroid/pdfnet/api/pdftron.PDF.PDFViewCtrl.html):

{% code lineNumbers="true" %}

```csharp
fun showBookmarksDialog(fragmentManager: FragmentManager, pdfViewCtrl: PDFViewCtrl): BookmarksDialogFragment {
    var bookmarksDialog = pdftron.PDF.Dialog.BookmarksDialogFragment.NewInstance();
    bookmarksDialog.SetPdfViewCtrl(pdfViewCtrl);
    List<DialogFragmentTab> tabs = new List<DialogFragmentTab>();
    var annotationsTab = new DialogFragmentTab(
        Java.Lang.Class.FromType(typeof(AnnotationDialogFragment)), BookmarksTabLayout.TagTabAnnotation, null, "Annotations", "Bookmarks Dialog", null);
    tabs.Add(annotationsTab);
    bookmarksDialog.SetDialogFragmentTabs(tabs);
    bookmarksDialog.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
    bookmarksDialog.Show(fragmentManager, "bookmarks_dialog");
    return bookmarksDialog;
}
```

{% endcode %}

## Listener

By calling `setAnnotationDialogListener(AnnotationDialogListener)`, you can set a listener to be notified when an annotation item is clicked, or when document annotations are exported to a PDF doc when users click on the export floating action button.

## Read-only

If the document has write access, users can delete existing annotations by long-pressing on the annotation. To specify whether the document is read-only call `setReadOnly(boolean)`.
{% endtab %}

{% tab title="iOS" %}

## View annotations as list in Xamarin.iOS

{% hint style="info" %}
**This tutorial only applies to Xamarin.iOS. See Xamarin.Android equivalent here .**
{% endhint %}

The [`PTAnnotationViewController`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.Controls.PTAnnotationViewController.html) class shows a list of all annotations in a document being viewed by a [`PTPDFViewCtrl`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.PDFViewCtrl.html). The list contains any comments that have been added to the annotations.

![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-3b4fe3f15304cc68df980f8cdd4bc58c4130a6d3%2F08935ed43ed617260c9ad07c1e040c5114e3ba47-1242x2208.png?alt=media)

*The annotations list control is part of the Tools library, so make sure you have* [*added the Tools library to your project*](/xamarin/ui-customization/setup.md)*.*

## Show an annotation view controller

To create a new annotation view controller instance and display it from another view controller, supply a `PTPDFViewCtrl` instance to the `PTAnnotationViewController` designated initializer:

{% code lineNumbers="true" %}

```csharp
var annotationViewController = new pdftron.PDF.Controls.PTAnnotationViewController (mPdfViewCtrl);
annotationViewController.AnnotationViewControllerAnnotationSelected += (object sender, AnnotationViewControllerAnnotationSelectedEventArgs e) => {
    // perform custom action
    this.DismissViewController (true, null);
};
annotationViewController.AnnotationViewControllerDidCancel += (object sender, EventArgs e) => {
    this.DismissViewController (true, null);
};

var navigationController = new UINavigationController (annotationViewController);
if (UserInterfaceIdiomIsPad)
{
    navigationController.ModalPresentationStyle = UIModalPresentationStyle.Popover;
    navigationController.PopoverPresentationController.BarButtonItem = annotationListButton;
}

this.PresentViewController (navigationController, true, null);
```

{% endcode %}

{% hint style="info" %}
**The annotation view controller must be pushed onto a navigation controller's stack before being shown.**
{% endhint %}

{% hint style="info" %}
**Presenting on iPads:**

The annotation view controller is designed to be presented in a popover on iPads. To do so, you must provide the `PTAnnotationViewController`'s [`PopoverPresentationController`](https://docs.microsoft.com/en-us/dotnet/api/uikit.uipopoverpresentationcontroller) with either:

* a [`SourceRect`](https://docs.microsoft.com/en-us/dotnet/api/uikit.uipopoverpresentationcontroller.sourcerect#UIKit_UIPopoverPresentationController_SourceRect) AND
* a [`SourceView`](https://docs.microsoft.com/en-us/dotnet/api/uikit.uipopoverpresentationcontroller.sourceview#UIKit_UIPopoverPresentationController_SourceView)

OR

* a [`BarButtonItem`](https://docs.microsoft.com/en-us/dotnet/api/uikit.uipopoverpresentationcontroller.barbuttonitem#UIKit_UIPopoverPresentationController_BarButtonItem)

as in the example above.
{% endhint %}

You can set a delegate to be notified by the annotation view controller when annotations are selected with the `PTAnnotationViewControllerDelegate` protocol. (See the CompleteReader sample for usage of the `PTAnnotationViewController`.)
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/xamarin/annotation/annotation-list.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
