Some test text!

Search
Hamburger Icon

Xamarin / Guides / Style editor

Style editor

You can edit the style properties of annoations.

Annotations style editor in Xamarin

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

AnnotStyleDialogFragment is a DialogFragment 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.

Annotation style dialog
To learn about customizing style dialog, see the customize style dialog guide .

Show an annotation style dialog

The AnnotationStyleDialogFragment.Builder class allows you to create an AnnotStyleDialogFragment with a specified AnnotStyle. The AnnotStyle represents the initial annotation style to display.

Example

// 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();

Afterwards, to show an annotation style dialog call Show(FragmentManager). Similarly, to dismiss the annotation style dialog programmatically call Dismiss().

Listen to annotation style changes

You can listen to annotation style changes by setting an OnAnnotStyleChangeListener to your AnnotStyleDialogFragment using SetOnAnnotStyleChangeListener. The AnnotStyleDialogFragment 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.

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) =>
{

};
To learn about changing annotation style, see the change annotation properties guide.

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales