List Container

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

List container to customize horizontal menu layout in Xamarin.iOS

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

The PTNavigationListsViewController class is a container view controller that shows the annotation list, document outline, and user-defined bookmark list controls with a UITabBarController-like interface. A segmented control is used to select which child view controller to display.

Apryse Docs Image

The navigation lists control is part of the Tools library, so make sure you have added the Tools library to your project.

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

C#

1var navigationListsViewController = new PTNavigationListsViewController(mToolManager);
2
3var annotationViewController = new PTAnnotationViewController(mPdfViewCtrl);
4annotationViewController.AnnotationViewControllerAnnotationSelected += (object sender, AnnotationViewControllerAnnotationSelectedEventArgs e) => {
5 // perform custom action
6};
7annotationViewController.AnnotationViewControllerDidCancel += (object sender, EventArgs e) => {
8 // perform custom action
9};
10
11var outlineViewController = new PTOutlineViewController (mPdfViewCtrl);
12outlineViewController.OutlineViewControllerOutlineSelected += (sender, e) => {
13 // perform custom action
14};
15outlineViewController.OutlineViewControllerDidCancel += (object sender, EventArgs e) => {
16 // perform custom action
17};
18
19var bookmarkViewController = new PTBookmarkViewController (mPdfViewCtrl);
20bookmarkViewController.BookmarkViewControllerBookmarkSelected += (sender, e) => {
21 // perform custom action
22};
23bookmarkViewController.BookmarkViewControllerDidCancel += (object sender, EventArgs e) => {
24 // perform custom action
25};
26
27navigationListsViewController.ListViewControllers = new UIViewController[] {
28 outlineViewController, annotationViewController, bookmarkViewController
29};
30if (UserInterfaceIdiomIsPhone)
31{
32 navigationListsViewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
33} else{
34 navigationListsViewController.ModalPresentationStyle = UIModalPresentationStyle.Popover;
35 navigationListsViewController.PopoverPresentationController.BarButtonItem = navigationListsButton;
36}
37this.PresentViewController(navigationListsViewController, true, null);

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 with either:

OR

as in the example above.

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 , or the SelectedViewController property can be used.

C#

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

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales