> 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/set-tool-to-toolmanager.md).

# Set Tool mode

Learn how to change the default tool mode in Xamarin.Android and Xamarin.iOS using UI components or programmatically. Set up the ToolManager and switch tools easily with this tutorial. The Apryse Xama

You can set the current tool using the UI components as well as programmatically.

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

## Changing default tool mode in Xamarin.Android

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

When setting up the [`ToolManager`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Tools.ToolManager.html), the default [`Tool`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Tools.Tool.html) is the [`Pan`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Tools.Pan.html) Tool. To change the tool, use [`ToolManager.setTool(ToolManager.Tool)`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Tools.ToolManager.html#pdftron_PDF_Tools_ToolManager_Tool) API.

For example, to switch to the Text Highlighting tool, do the following:

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

```csharp
mToolManager.Tool = mToolManager.CreateTool(ToolManager.ToolMode.TextHighlight, mToolManager.Tool);
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
mToolManager.setTool(mToolManager.createTool(ToolMode.TEXT_HIGHLIGHT, mToolManager.getTool()));
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
mToolManager.tool = mToolManager.createTool(ToolMode.TEXT_HIGHLIGHT, mToolManager.tool)
```

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

To continuously using the same tool, do:

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

```csharp
var tool = mToolManager.CreateTool(ToolManager.ToolMode.TextHighlight, mToolManager.Tool);
((Tool) tool).ForceSameNextToolMode = true;
mToolManager.Tool = tool;
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
Tool tool = mToolManager.createTool(ToolMode.TEXT_HIGHLIGHT, mToolManager.getTool())
((Tool) tool).setForceSameNextToolMode(true)
mToolManager.setTool(tool);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val tool = mToolManager.createTool(ToolMode.TEXT_HIGHLIGHT, mToolManager.tool)
(tool as Tool).isForceSameNextToolMode = true
mToolManager.tool = tool
```

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

{% tab title="iOS" %}

## Changing default tool mode in Xamarin.iOS

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

Changing tools in Xamarin.iOS is identical to changing tools in iOS. See [tutorial in iOS guides](/xamarin/ui-customization/setup.md).

{% code lineNumbers="true" %}

```csharp
// change to free text tool
var newTool = mToolManager.ChangeTool(new Class(typeof(pdftron.PDF.Tools.PTFreeTextCreate)));
((pdftron.PDF.Tools.PTTool)newTool).BackToPanToolAfterUse = true;
```

{% 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/set-tool-to-toolmanager.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.
