Property Expression
Expression
Gets or sets the expression script used to calculate the label text.
Declaration
public LabelExpression Expression { get; set; }
Property Value
Type | Description |
---|---|
LabelExpression | The expression script used to calculate the label text. |
Remarks
The expression may be a combination of literal text and attribute values from the feature being labeled.
The syntax of the expression is determined by which label expression implementation is used: ArcadeLabelExpression, SimpleLabelExpression, or WebmapLabelExpression.
A label expression using one scripting language can be replaced by an expression using a different scripting language just by creating an object of the new LabelExpression subclass and assigning it to Expression.
The default value is an empty ArcadeLabelExpression, which will evaluate to an empty text label.
The expression needs to create a text string which will be used as the label text. The text string can be any legal UTF16 characters.
The text string can also include HTML-style formatting tags. Example: "Hello <BOL>World</BOL>". In this example, the angle-bracketed tags will not appear in the label, but may change the presentation of the text. In this example, the "World" will appear in bold.
The available tags are:
- "<BOL></BOL>" for bold text
- "<UND></UND$gt;" for underlined text
- "<ITA></ITA>" for italic text
- "<CLR red='256'></CLR>" for colored text
- "<FNT name='Arial' size='18'></FNT>" for text using a different size or font (if available on client)
Tags can be upper or lower case, but not a mixture. Tags can be nested, example: "<ITA>Hello <BOL>World</BOL></ITA>".
Full documentation of the tag parameters is available at Text formatting tags.
Note that not all ArcGISPro tags are currently supported in this API. The "<CLR>" tag is currently only supported for text in 2D views. Any unsupported tags will be ignored and not written as part of the label text.
Warning: If the expression attempts to use attributes which don't exist then no label will be produced. This is distinct from the attribute existing but having a null or empty value, which can form part of the produced text label.
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Standard 2.0 | 100.11 - 200.6 |
.NET | 100.13 - 200.6 |
.NET Windows | 100.13 - 200.6 |
.NET Android | 200.0 - 200.6 |
.NET iOS | 200.0 - 200.6 |
.NET Framework | 100.11 - 200.6 |
Xamarin.Android | 100.11 - 100.15 |
Xamarin.iOS | 100.11 - 100.15 |
UWP | 100.11 - 200.6 |