> 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/basic-operations/basics/view-mode-dialog.md).

# View mode dialog

Learn how to use ViewModePickerDialogFragment in Xamarin.Android to pick page layout mode, select page color mode, rotate and crop pages. Set up view mode dialog and implement events for user interact

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

[`ViewModePickerDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html) allows users to: [pick page layout mode](/xamarin/guides/android/viewer/view-mode.md#layout), [select page color mode](/xamarin/guides/android/viewer/themes.md#custom), [rotate pages](/xamarin/guides/android/manipulation/rotate-pages.md#ui-component), and [crop pages](/xamarin/guides/android/manipulation/rotate-pages.md#ui-component).

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

## Show view mode dialog

To show a view mode dialog in your activity, create a new instance of [`ViewModePickerDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html) by calling `newInstance(PagePresentationMode, boolean, boolean, int)`:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
public void ShowViewModeDialog()
{
    var viewModeDialog = pdftron.PDF.Dialog.ViewModePickerDialogFragment.NewInstance(mPdfViewCtrl.PagePresentationMode,
      false, mReflowControl.Visibility == ViewStates.Visible, 0);
    viewModeDialog.SetStyle((int)DialogFragmentStyle.Normal, Resource.Style.PDFTronAppTheme);
    viewModeDialog.Show(this.SupportFragmentManager, "view_mode_picker");
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Set view mode dialog listener

In order to let users pick PDF page presentation mode, color mode, etc. you need to implement the corresponding [events](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html#events) in the [`ViewModePickerDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html) instance.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
viewModeDialog.CustomColorModeSelected += (sender, e) =>
{
    // save the selection so we can retrieve it next time
    PdfViewCtrlSettingsManager.SetCustomColorModeBGColor(this, e.BgColor);
    PdfViewCtrlSettingsManager.SetCustomColorModeTextColor(this, e.TxtColor);
    PdfViewCtrlSettingsManager.SetColorMode(this, PdfViewCtrlSettingsManager.KeyPrefColorModeCustom);
    // Do something with e.BgColor and e.TxtColor
};

viewModeDialog.ViewModeColorSelected += (sender, e) =>
{
    // save the selection so we can retrieve it next time
    PdfViewCtrlSettingsManager.SetColorMode(this, e.ColorMode);
    // Do something with e.ColorMode
};

viewModeDialog.ViewModeSelected += (sender, e) =>
{
    // Do something with e.ViewMode
};
```

{% endcode %}
{% endtab %}
{% endtabs %}

In [`ViewModeSelected`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html#pdftron_PDF_Dialog_ViewModePickerDialogFragment_ViewModeSelected), the selected view mode values are defined in `PdfViewCtrlSettingsManager` and include the following:

| **View Mode**                              | **Description**                                                                             | **Value**           |
| ------------------------------------------ | ------------------------------------------------------------------------------------------- | ------------------- |
| `KEY_PREF_VIEWMODE_CONTINUOUS_VALUE`       | Single page in continuous mode is selected.                                                 | "continuous"        |
| `KEY_PREF_VIEWMODE_SINGLEPAGE_VALUE`       | Single page presentation mode is selected.                                                  | "singlepage"        |
| `KEY_PREF_VIEWMODE_FACING_VALUE`           | Facing two pages presentation mode is selected.                                             | "facing"            |
| `KEY_PREF_VIEWMODE_FACINGCOVER_VALUE`      | Facing two pages with odd page number on right side of PDF is selected.                     | "facingcover"       |
| `KEY_PREF_VIEWMODE_FACING_CONT_VALUE`      | In continuous mode, Facing two pages presentation mode is selected.                         | "facing\_cont"      |
| `KEY_PREF_VIEWMODE_FACINGCOVER_CONT_VALUE` | In continuous mode, Facing two pages with odd page number on right side of PDF is selected. | "facingcover\_cont" |
| `KEY_PREF_VIEWMODE_ROTATION_VALUE`         | Rotate pdf pages is selected.                                                               | "rotation"          |
| `KEY_PREF_VIEWMODE_USERCROP_VALUE`         | User-level crop pages is selected.                                                          | "user\_crop"        |

To learn about setting page presentation mode, see [PDFViewCtrl page presentation mode ](/xamarin/guides/android/viewer/view-mode.md#layout).

{% hint style="info" %}
To learn about setting page color mode, see [PDFViewCtrl color modes ](/xamarin/guides/android/viewer/themes.md#custom).
{% endhint %}

{% hint style="info" %}
To learn about reflow, see [reflow ](/xamarin/guides/android/viewer/view-mode.md#reflow).
{% endhint %}

{% hint style="info" %}
To learn about cropping pages, see [crop page dialog ](/xamarin/guides/android/manipulation/rotate-pages.md#ui-component).
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/xamarin/basic-operations/basics/view-mode-dialog.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
