> 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/style-editor-dialog.md).

# Annotations style editor in Xamarin

Learn how to customize annotation style dialog in Xamarin.Android with AnnotStyleDialogFragment. Change colors, thickness, and more with this advanced color picker. Customize your app's annotation sty

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

[`AnnotStyleDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.AnnotStyleDialogFragment.html) is a [`DialogFragment`](https://developer.android.com/reference/android/app/DialogFragment.html) that shows annotation style properties in a bottom sheet view. With this style dialog, users can change the annotation color with the advanced color picker or directly select preset styles. The style dialog also provides a recent and a favorite list for quick access.

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

{% hint style="info" %}
To learn about customizing style dialog, see the [customize style dialog guide ](/xamarin/annotation/customize-color-picker.md).
{% endhint %}

## Show an annotation style dialog

The `AnnotationStyleDialogFragment.Builder` class allows you to create an [`AnnotStyleDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.AnnotStyleDialogFragment.html) with a specified [`AnnotStyle`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Model.AnnotStyle.html). The [`AnnotStyle`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Model.AnnotStyle.html) represents the initial annotation style to display.

**Example**

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

```csharp
// 1. Instantiate an AnnotStyle with its constructor
var annotStyle = new pdftron.PDF.Model.AnnotStyle();
// 2. Set annotation type to annot style
annotStyle.AnnotType = (int)Annot.Type.e_Square;
// 3. Set blue stroke, yellow fill color, thickness 5, opacity 0.8 to the annotation style.
annotStyle.SetStyle(Android.Graphics.Color.Blue, Android.Graphics.Color.Yellow, 5, 0.8f);
// 4. Instantiate an AnnotStyleDialogFragment.Builder with its constructor
var styleDialogBuilder = new AnnotStyleDialogFragment.Builder(annotStyle);
// 5. Set anchor rectangle if you want the `AnnotStyleDialogFragment` be displayed as a popup window in tablet mode
styleDialogBuilder.SetAnchor(new Android.Graphics.Rect(0, 0, 100, 1000));
// 6. Build AnnotStyleDialogFragment with the arguments supplied to this builder.
var annotStyleDialog = styleDialogBuilder.Build();
```

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

Afterwards, to show an annotation style dialog call [`Show(FragmentManager)`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.AnnotStyleDialogFragment.html#pdftron_PDF_Controls_AnnotStyleDialogFragment_Show_Android_Support_V4_App_FragmentManager_). Similarly, to dismiss the annotation style dialog programmatically call [`Dismiss()`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.AnnotStyleDialogFragment.html#pdftron_PDF_Controls_AnnotStyleDialogFragment_Dismiss_System_Boolean_).

## Listen to annotation style changes

You can listen to annotation style changes by setting an `OnAnnotStyleChangeListener` to your [`AnnotStyleDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.AnnotStyleDialogFragment.html) using `SetOnAnnotStyleChangeListener`. The [`AnnotStyleDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.AnnotStyleDialogFragment.html) raises an event when a style change occurs (such as a color change, thickness change, text color change, etc., allowing you to define custom behavior for such events.

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

```csharp
annotStyleDialog.ChangeAnnotFillColor += (sender, e) =>
{

};
annotStyleDialog.ChangeAnnotFont += (sender, e) =>
{

};
annotStyleDialog.ChangeAnnotIcon += (sender, e) =>
{

};
annotStyleDialog.ChangeAnnotOpacity += (sender, e) =>
{

};
annotStyleDialog.ChangeAnnotStrokeColor += (sender, e) =>
{

};
annotStyleDialog.ChangeAnnotTextColor += (sender, e) =>
{

};
annotStyleDialog.ChangeAnnotTextSize += (sender, e) =>
{

};
annotStyleDialog.ChangeAnnotThickness += (sender, e) =>
{

};
```

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

{% hint style="info" %}
To learn about changing annotation style, see the change annotation properties guide.
{% 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 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/basic-operations/basics/style-editor-dialog.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.
