> 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/ui-customization/list-container.md).

# List Container

Learn how to customize horizontal menu layout in Xamarin.Android using the list container UI component. Display annotation, outline, and bookmark lists in separate tabs with BookmarksDialogFragment. T

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

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

## List container to customize horizontal menu layout in Xamarin.Android

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

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

* [Annotation list](/xamarin/annotation/annotation-list.md#android)
* [Document outline](/xamarin/guides/android/bookmark/outline.md#ui-component)
* [User-defined bookmark list](/xamarin/bookmarks/user-bookmarks.md#android)

![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-3769c92bdcad1d5b53edbb5cd4dc409efcd4329a%2F408eaa5f033c0bd4620b5e20efcea346589a7c84-600x1200.gif?alt=media)

## 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`](https://sdk.apryse.com/api/xamarinandroid/pdfnet/api/pdftron.PDF.PDFViewCtrl.html) and an `ArrayList` of `DialogFragmentTab`:

{% code lineNumbers="true" %}

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

{% endcode %}

`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:

| Dialog             | Type of class                    | Tab tag              |
| ------------------ | -------------------------------- | -------------------- |
| Annotation list    | AnnotationDialogFragment.class   | TAG\_TAB\_ANNOTATION |
| Document outline   | OutlineDialogFragment.class      | TAG\_TAB\_OUTLINE    |
| User bookmark list | UserBookmarkDialogFragment.class | TAG\_TAB\_BOOKMARK   |

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

{% code lineNumbers="true" %}

```csharp
using pdftron.PDF.Tools.Utils;

var bookmarksDialog = pdftron.PDF.Dialog.BookmarksDialogFragment.NewInstance();
bookmarksDialog.SetPdfViewCtrl(mPdfViewCtrl);
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);
tabs.Add(annotationsTab);
tabs.Add(outlineDialog);
tabs.Add(userBookmarksDialog);
bookmarksDialog.SetDialogFragmentTabs(tabs);
bookmarksDialog.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
bookmarksDialog.Show(this.SupportFragmentManager, "bookmarks_dialog");
bookmarksDialog.AnnotationClicked += (sender, e) =>
{
    bookmarksDialog.Dismiss();
};
bookmarksDialog.ExportAnnotations += (sender, e) =>
{
    // handle export annotations here
    bookmarksDialog.Dismiss();
};
bookmarksDialog.OutlineClicked += (sender, e) =>
{
    bookmarksDialog.Dismiss();
};
bookmarksDialog.UserBookmarkClick += (sender, e) =>
{
    mPdfViewCtrl.SetCurrentPage(e.PageNum);
    bookmarksDialog.Dismiss();
};
```

{% endcode %}

## Customization

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`.
{% endtab %}

{% tab title="iOS" %}

## List container to customize horizontal menu layout in Xamarin.iOS

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

The [`PTNavigationListsViewController`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.Controls.PTNavigationListsViewController.html) class is a container view controller that shows the [annotation list](/xamarin/annotation/annotation-list.md#ios), [document outline](/xamarin/guides/ios/bookmark/outline.md#ui-component), and [user-defined bookmark](/xamarin/bookmarks/user-bookmarks.md#ios) list controls with a `UITabBarController`-like interface. A segmented control is used to select which child view controller to display.

![](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 navigation lists 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 a navigation lists view controller

To create a new navigation lists view controller and display it from another view controller, set the child list view controllers to the `PTNavigationListsViewController` class's [`ListViewControllers`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.Controls.PTNavigationListsViewController.html#pdftron_PDF_Controls_PTNavigationListsViewController_ListViewControllers) property:

{% code lineNumbers="true" %}

```csharp
var navigationListsViewController = new PTNavigationListsViewController(mToolManager);

var annotationViewController = new PTAnnotationViewController(mPdfViewCtrl);
annotationViewController.AnnotationViewControllerAnnotationSelected += (object sender, AnnotationViewControllerAnnotationSelectedEventArgs e) => {
    // perform custom action
};
annotationViewController.AnnotationViewControllerDidCancel += (object sender, EventArgs e) => {
    // perform custom action
};

var outlineViewController = new PTOutlineViewController (mPdfViewCtrl);
outlineViewController.OutlineViewControllerOutlineSelected += (sender, e) => {
    // perform custom action
};
outlineViewController.OutlineViewControllerDidCancel += (object sender, EventArgs e) => {
    // perform custom action
};

var bookmarkViewController = new PTBookmarkViewController (mPdfViewCtrl);
bookmarkViewController.BookmarkViewControllerBookmarkSelected += (sender, e) => {
    // perform custom action
};
bookmarkViewController.BookmarkViewControllerDidCancel += (object sender, EventArgs e) => {
    // perform custom action
};

navigationListsViewController.ListViewControllers = new UIViewController[] {
    outlineViewController, annotationViewController, bookmarkViewController
};
if (UserInterfaceIdiomIsPhone)
{
  navigationListsViewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
} else{
  navigationListsViewController.ModalPresentationStyle = UIModalPresentationStyle.Popover;
  navigationListsViewController.PopoverPresentationController.BarButtonItem = navigationListsButton;
}
this.PresentViewController(navigationListsViewController, true, null);
```

{% endcode %}

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

The navigation list view controller is designed to be presented in a popover on iPads. To do so, you must provide the `PTNavigationListsViewController`'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 %}

## Customization

The `PTNavigationListViewController` provides a flexible API for displaying only the desired child view controllers. Any of the annotation list, document outline, or user-defined bookmark list view controllers can be removed by omitting them from the `listViewControllers` property. It is also possible to add a custom child view controller by adding it to the `listViewControllers` array.

To specify which of the child view controllers to display on opening the navigation list control, either the [`SelectedIndex`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.Controls.PTNavigationListsViewController.html#pdftron_PDF_Controls_PTNavigationListsViewController_SelectedIndex) , or the [`SelectedViewController`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.Controls.PTNavigationListsViewController.html#pdftron_PDF_Controls_PTNavigationListsViewController_SelectedViewController) property can be used.

{% code lineNumbers="true" %}

```csharp
// Show the navigationListsViewController's annotationViewController on opening
navigationListsViewController.SelectedViewController = navigationListsViewController.annotationViewController;
// OR specify an index to show from the `listViewControllers` property
navigationListsViewController.SelectedIndex = 0;
```

{% endcode %}
{% 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/ui-customization/list-container.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.
