Back to Devexpress

MapItem.EnableHighlighting Property

windowsforms-devexpress-dot-xtramap-dot-mapitem-a43c1622.md

latest3.7 KB
Original Source

MapItem.EnableHighlighting Property

Indicates whether a map item can be highlighted.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue(DefaultBoolean.Default)]
public DefaultBoolean EnableHighlighting { get; set; }
vb
<DefaultValue(DefaultBoolean.Default)>
Public Property EnableHighlighting As DefaultBoolean

Property Value

TypeDefaultDescription
DefaultBooleanDefault

true if a map item can be highlighted; otherwise, false.

|

Available values:

NameDescriptionReturn Value
True

The value is true.

|

0

| | False |

The value is false.

|

1

| | Default |

The value is specified by a global option or a higher-level object.

|

2

|

Remarks

The MapItem.EnableHighlighting property has a higher priority than the MapItemsLayerBase.EnableHighlighting property specified for the map layer that contains the map item.

The following example disables highlighting for all items on the itemsLayer except the MapEllipse item:

csharp
private void Form1_Load(object sender, EventArgs e) {
    //...
    // Create a layer to display vector items.
    VectorItemsLayer itemsLayer = new VectorItemsLayer();
    itemsLayer.EnableHighlighting = false;
    map.Layers.Add(itemsLayer);

    // Create storage for map items and generate them.
    MapItemStorage storage = new MapItemStorage();
    MapItem[] myItems = GetMapItems();
    storage.Items.AddRange(myItems);
    itemsLayer.Data = storage;
}

// Create an array of map items.
MapItem[] GetMapItems() {
    return new MapItem[] {
        new MapDot() { Location = new GeoPoint(55, 0), Size=30},
        new MapEllipse() { Location = new GeoPoint(40, 12), Width = 2000, Height = 1000, 
                           EnableHighlighting = DefaultBoolean.True },
        new MapRectangle() { Location = new GeoPoint(60, 13), Width = 1500, Height = 1000 }
    };
}
vb
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    '...
    ' Create a layer to display vector items.
    Dim itemsLayer As VectorItemsLayer = New VectorItemsLayer()
    itemsLayer.EnableHighlighting = False
    map.Layers.Add(itemsLayer)

    ' Create storage for map items and generate them.
    Dim storage As MapItemStorage = New MapItemStorage()
    Dim myItems As MapItem() = GetMapItems()
    storage.Items.AddRange(myItems)
    itemsLayer.Data = storage
End Sub

' Create an array of map items.
Private Function GetMapItems() As MapItem()
    Return New MapItem() {New MapDot() With {
        .Location = New GeoPoint(55, 0),
        .Size = 30
    }, New MapEllipse() With {
        .Location = New GeoPoint(40, 12),
        .Width = 2000,
        .Height = 1000,
        .EnableHighlighting = DefaultBoolean.[True]
    }, New MapRectangle() With {
        .Location = New GeoPoint(60, 13),
        .Width = 1500,
        .Height = 1000
    }}
End Function

See Also

MapItem Class

MapItem Members

DevExpress.XtraMap Namespace