Class LabelStyle
Defines a style used for rendering labels
Implements
Inherited Members
Namespace: Mapsui.Styles
Assembly: Mapsui.dll
Syntax
public class LabelStyle : BaseStyle, 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./>.
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 the position of labels with respect to objects label point
Declaration
public Offset Offset { get; set; }
Property Value
| Type | Description |
|---|---|
| Offset |
RelativeOffset
Specifies the position of labels with respect to objects label point relative to the size of the label. Where X = 0.0 and Y = 0.0 would center the label and X = 0.5 and Y = 0.5 will have the label on the bottom right. be drawn with the bottom left corner at the label point.
Declaration
public RelativeOffset RelativeOffset { get; set; }
Property Value
| Type | Description |
|---|---|
| RelativeOffset |
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 |