Class LabelStyle
Defines a style used for rendering labels
Implements
Inherited Members
Namespace: Mapsui.Styles
Assembly: Mapsui.dll
Syntax
public class LabelStyle : Style, IStyle
Constructors
| Edit this page View SourceLabelStyle()
Declaration
public LabelStyle()
LabelStyle(LabelStyle)
Declaration
public LabelStyle(LabelStyle labelStyle)
Parameters
Type | Name | Description |
---|---|---|
LabelStyle | labelStyle |
Properties
| Edit this page View SourceBackColor
The background color of the label. Set to transparent brush or null if background isn't needed
Declaration
public Brush? BackColor { get; set; }
Property Value
Type | Description |
---|---|
Brush |
BorderColor
The color of the border around the background.
Declaration
public Color BorderColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
BorderThickness
The thickness of the border around the background.
Declaration
public double BorderThickness { get; set; }
Property Value
Type | Description |
---|---|
double |
CollisionDetection
Gets or sets whether Collision Detection is enabled for the labels. If set to true, label collision will be tested.
Declaration
public bool CollisionDetection { get; set; }
Property Value
Type | Description |
---|---|
bool |
CornerRounding
The radius of the oval used to round the corners of the background. See SkiaSharp.SkCanvas.DrawRoundRect.
Declaration
public int CornerRounding { get; set; }
Property Value
Type | Description |
---|---|
int |
Font
Label Font
Declaration
public Font Font { get; set; }
Property Value
Type | Description |
---|---|
Font |
ForeColor
Font color
Declaration
public Color ForeColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
Halo
Creates a halo around the text
Declaration
public Pen? Halo { get; set; }
Property Value
Type | Description |
---|---|
Pen |
HorizontalAlignment
The horizontal alignment of the text in relation to the label point
Declaration
public LabelStyle.HorizontalAlignmentEnum HorizontalAlignment { get; set; }
Property Value
Type | Description |
---|---|
LabelStyle.HorizontalAlignmentEnum |
LabelColumn
The column of the feature used by GetLabelText to return the label text.
Declaration
public string? LabelColumn { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
Used only when LabelMethod is not set. Overrides use of the Text field.
LabelMethod
Method used by GetLabelText to return the label text.
Declaration
public Func<IFeature, string?>? LabelMethod { get; set; }
Property Value
Type | Description |
---|---|
Func<IFeature, string> |
Remarks
Overrides use of Text and LabelColumn fields.
LineHeight
Space from one text line to next text line in em
Declaration
public double LineHeight { get; set; }
Property Value
Type | Description |
---|---|
double |
MaxWidth
Maximum width of text in em. If text is wider than this, text is shorten or word wrapped regarding WordWrap.
Declaration
public double MaxWidth { get; set; }
Property Value
Type | Description |
---|---|
double |
Offset
Specifies relative position of labels with respect to objects label point
Declaration
public Offset Offset { get; set; }
Property Value
Type | Description |
---|---|
Offset |
Text
The text used for this specific label.
Declaration
public string? Text { set; }
Property Value
Type | Description |
---|---|
string |
Remarks
Used only when LabelColumn and LabelMethod are not set.
VerticalAlignment
The horizontal alignment of the text in relation to the label point
Declaration
public LabelStyle.VerticalAlignmentEnum VerticalAlignment { get; set; }
Property Value
Type | Description |
---|---|
LabelStyle.VerticalAlignmentEnum |
WordWrap
Line break mode for text, if width is bigger than MaxWidth
Declaration
public LabelStyle.LineBreakMode WordWrap { get; set; }
Property Value
Type | Description |
---|---|
LabelStyle.LineBreakMode |
Methods
| Edit this page View SourceGetLabelText(IFeature)
The text used for this specific label.
Declaration
public string? GetLabelText(IFeature feature)
Parameters
Type | Name | Description |
---|---|---|
IFeature | feature |
Returns
Type | Description |
---|---|
string |