Annotation style editor

In this document
chevron_rightIn Xamarin.Android
chevron_rightIn Xamarin.iOS

In Xamarin.Android

Using annotation style editor in Xamarin.Android is identical to using annotation style editor in Android. See tutorial here.

For example, the equivalent of the example provided in the Android guide will be:

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

To show:

// To show
annotStyleDialog.Show(this);

To dismiss programmatically:

annotStyleDialog.Dismiss();

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

};

In Xamarin.iOS

Using annotation style editor in Xamarin.iOS is identical to using annotation style editor in iOS. See tutorial here.

For example, the equivalent of the example provided in the iOS guide will be:

// Initialize annot style with a Annot instance or PTAnnotType.
var annotStyle = new AnnotStyle(PTAnnotType.e_ptSquare);
var stylePicker = new AnnotStyleViewController(annotStyle);

// Save a strong reference to a half-modal presentation manager.
this.halfModalPresentationManager = new HalfModalPresentationManager();

// Display annotation style view controller with a half-modal UIPresentationController.
stylePicker.ModalPresentationStyle = UIModalPresentationStyle.Custom;
stylePicker.TransitioningDelegate = this.halfModalPresentationManager;

// To show
this.PresentModalViewController(stylePicker, true);

Subscribe to events:

stylePicker.DidChangeStyle += (sender, e) =>
{
  
};
stylePicker.DidCommitStyle += (sender, e) =>
{
  
};