Back to Devexpress

ShapeTitleOptions.Pattern Property

windowsforms-devexpress-dot-xtramap-dot-shapetitleoptions.md

latest5.2 KB
Original Source

ShapeTitleOptions.Pattern Property

Gets or sets the pattern for shape titles.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue("")]
public string Pattern { get; set; }
vb
<DefaultValue("")>
Public Property Pattern As String

Property Value

TypeDefaultDescription
StringString.Empty

A String value.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to Pattern
MapShape

.TitleOptions .Pattern

|

Remarks

This property allows specifying text displaying as a title of a vector item. Also it allows using attributes to show them inside the title.

Example

This example demonstrates how to customize shape title options. To do this, customize the required properties from the following list.

csharp
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraMap;
// ...
private void Form1_Load(object sender, System.EventArgs e) {
    MapItemStorage storage = new MapItemStorage();
    VectorItemsLayer layer = new VectorItemsLayer() {
        Data = storage
    };

    dot = new MapDot() { Size = 100 };
    dot.TitleOptions.TextColor = Color.Orange;
    dot.TitleOptions.TextGlowColor = Color.Black;
    dot.TitleOptions.Pattern = "{Title}";

    dot.Attributes.Add(new MapItemAttribute() { Name = "Title", Value = "Hello,\nI am Dot." });
    storage.Items.Add(dot);

    mapControl1.Layers.Add(layer);
}
vb
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.XtraMap
' ...
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim storage As New MapItemStorage()
    Dim layer As New VectorItemsLayer() With {.Data = storage}

    dot = New MapDot() With {.Size = 100}
    dot.TitleOptions.TextColor = Color.Orange
    dot.TitleOptions.TextGlowColor = Color.Black
    dot.TitleOptions.Pattern = "{Title}"

    dot.Attributes.Add(New MapItemAttribute() With {.Name = "Title", .Value = "Hello," & ControlChars.Lf & "I am Dot."})
    storage.Items.Add(dot)

    mapControl1.Layers.Add(layer)
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Pattern property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-map-aggregate-vector-items-using-a-clusterer/CS/ClustererSample/Form1.cs#L60

csharp
public void CustomizeCluster(MapItem cluster) {
    ((MapDot)cluster).TitleOptions.Pattern = cluster.ClusteredItems.Count.ToString();
}

winforms-map-aggregate-vector-items-using-a-clusterer/VB/ClustererSample/Form1.vb#L62

vb
Private Sub IClusterItemFactory_CustomizeCluster(cluster As MapItem) Implements IClusterItemFactory.CustomizeCluster
    CType(cluster, MapDot).TitleOptions.Pattern = cluster.ClusteredItems.Count.ToString()
End Sub

See Also

ShapeTitleOptions Class

ShapeTitleOptions Members

DevExpress.XtraMap Namespace