Annotation properties have default settings and can be changed programmatically.
This tutorial only applies to Xamarin.Android. See Xamarin.iOS equivalent here.
When creating a new annotation, the initial properties (such as line thickness, fill color, opacity, etc.) are set to the last value that the user selected for an annotation of that type. For example, if the user changes an ellipse annotation's stroke color from green to red, the next ellipse annotation that the user creates would have a stroke color of red. These default properties are saved in the app's SharedPreferences.
These default properties can be changed programmatically and will take effect the next time when the annotation is created.
For example, to change style properties of a rectangle:
where toolManager is an instance of ToolManager.
A table for annotation type and tool mode mapping can be found here: annotation and its creation tool.
Each annotation has a default style that is defined by its creation tool. For example, when you create a Square annotation using the tool for the first time, the default behavior to draw a rectangle with a red border and a transparent fill color. These default colors can changed through XML attributes.
However the effect will only take place when the app is first loaded.
styles.xml file. For details on supported style attributes, see Tool Style Attributes.2. Add the style resource to ToolStyleConfig by calling AddDefaultStyleMap(Int32, Int32).
The first parameter of addDefaultStyleMap is an annotation type. You can determine the annotation type from the creator tool by referring to the Table of annotations and its creation tool.
annot_color Annotation color. For annotations that have an annot_fill_color, it represents stroke color.
format: color
annot_text_color Annotation text color. Used for FreeText annotations.
format: color
annot_fill_colorAnnotation fill color. Used for annotations that have fill colors, including Square, Circle, and FreeText.
format: color
annot_font_sizeAnnotation font size. Used for FreeText annotations.
format: float
annot_text_size_maxRepresents a FreeText annotation's maximum font size.
format: float
annot_text_size_minRepresents a FreeText annotation's minimum font size.
format: float
annot_thicknessAnnotation thickness for border style
format: float
annot_thickness_maxAnnotation maximum thickness
format: float
annot_thickness_minAnnotation minimum thickness
format: float
annot_fontAnnotation font. Used for FreeText annotations.
format: string
annot_opacityAnnotation opacity
format: float
annot_iconAnnotation icon. Used for Text annotations.
format: string
This tutorial only applies to Xamarin.iOS. See Xamarin.Android equivalent here.
When creating a new annotation, the initial properties (such as line thickness, fill colour, opacity, etc.) are set to the last value that the user selected for an annotation of that type. For example, if the user changes an ellipse annotation's stroke color from green to red, the next ellipse annotation that the user creates would have a stroke color of red. These default colors are saved in the app's user default dictionary.
The tools read and write values via the Tools packagePTColorDefaults type (class) interface.
Sets the default stroke color for rectangle annotations.
Available properties:
Property name | Key |
|---|---|
Stroke color | "Color" |
Fill color | "FillColor" |
Opacity | "Opacity" |
Border thickness | "BorderThickness" |
Free text size | "FreeTextSize" |
Reads the default fill color for ellipse annotations.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales