Some test text!

Discord Logo

Chat with us

PDFTron is now Apryse, learn more here.

Xamarin / Guides / List container



PDFTron is now Apryse, learn more here.

List Container

The list container is a UI component that contains other components related to annotations and bookmarks.

Display & customize list container in Xamarin

This tutorial only applies to Xamarin.Android. See Xamarin.iOS equivalent here .

The list container provides a horizontal layout to display the following items in separate tabs:

Bookmarks dialog

Show list container

The list container is implemented by the BookmarksDialogFragment class. To show this fragment in your activity, create a new instance of BookmarksDialogFragment by calling newInstance(). Afterwards, initialize your fragment by setting the PDFViewCtrl and an ArrayList of DialogFragmentTab:

private PDFViewCtrl mPdfViewCtrl;
// ...
public void ShowBookmarksDialog(List<DialogFragmentTab> dialogFragmentTabs,
                                FragmentManager fragmentManager) {
    var fragment = BookmarksDialogFragment.NewInstance();
    // Set a custom style for this fragment
    fragment.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
    // Show the dialog
    fragment.Show(fragmentManager, "bookmarks_dialog");

DialogFragmentTab specifies the information about each tab including the type of class and the tab tag. Currently the following dialogs can be displayed within the bookmarks dialog:

DialogType of classTab tag
Annotation listAnnotationDialogFragment.classTAG_TAB_ANNOTATION
Document outlineOutlineDialogFragment.classTAG_TAB_OUTLINE
User bookmark listUserBookmarkDialogFragment.classTAG_TAB_BOOKMARK

The following example shows how to display an annotations list, a document outline, and a user-defined bookmark list tabs in BookmarksDialogFragment:

using pdftron.PDF.Tools.Utils;

var bookmarksDialog = pdftron.PDF.Dialog.BookmarksDialogFragment.NewInstance();
List<DialogFragmentTab> tabs = new List<DialogFragmentTab>();
var annotationsTab = new DialogFragmentTab(
    Java.Lang.Class.FromType(typeof(AnnotationDialogFragment)), BookmarksTabLayout.TagTabAnnotation, null, "Annotations", "Bookmarks Dialog", null);
var outlineDialog = new DialogFragmentTab(
    Java.Lang.Class.FromType(typeof(OutlineDialogFragment)), BookmarksTabLayout.TagTabOutline, null, "Outline", "Bookmarks Dialog", null);
var userBookmarksDialog = new DialogFragmentTab(
    Java.Lang.Class.FromType(typeof(UserBookmarkDialogFragment)), BookmarksTabLayout.TagTabBookmark, null, "User Bookmarks", "Bookmarks Dialog", null);
bookmarksDialog.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
bookmarksDialog.Show(this.SupportFragmentManager, "bookmarks_dialog");
bookmarksDialog.AnnotationClicked += (sender, e) =>
bookmarksDialog.ExportAnnotations += (sender, e) =>
    // handle export annotations here
bookmarksDialog.OutlineClicked += (sender, e) =>
bookmarksDialog.UserBookmarkClick += (sender, e) =>


The BookmarksDialogFragment provides a flexible API for displaying only the desired child view. Any of the annotation list, document outline, or user-defined bookmark list view can be removed by omitting them from the DialogFragmentTabs.

Get the answers you need: Support