Back to Devexpress

MiniMapLayerCollection Class

windowsforms-devexpress-dot-xtramap-7eb7c5ae.md

latest4.4 KB
Original Source

MiniMapLayerCollection Class

A collection of mini map layers.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public class MiniMapLayerCollection :
    DXNamedItemCollection<MiniMapLayerBase>,
    ISupportSwapItems
vb
Public Class MiniMapLayerCollection
    Inherits DXNamedItemCollection(Of MiniMapLayerBase)
    Implements ISupportSwapItems

The following members return MiniMapLayerCollection objects:

Remarks

An instance of the MiniMapLayerCollection collection can be accessed using the MiniMap.Layers property.

Example

This example demonstrates how to customize mini map layers.

To do this, create the required MiniMapLayerBase class descendant objects, configure them and add them to the MiniMap.Layers collection.

View Example

csharp
mapControl.MiniMap = CreateMiniMap(data);
MiniMap CreateMiniMap(object data) {

    MiniMap miniMap = new MiniMap() {
        Height = 200,
        Width = 300,
        Behavior = new FixedMiniMapBehavior() {
            CenterPoint = new GeoPoint(-35, 140),
            ZoomLevel = 3
        }
    };

    MiniMapImageTilesLayer mapLayer = new MiniMapImageTilesLayer() {
        DataProvider = new BingMapDataProvider() {
            BingKey = bingKey,
            Kind = BingMapKind.Area
        }
    };

    MiniMapVectorItemsLayer vectorLayer = new MiniMapVectorItemsLayer();
    ListSourceDataAdapter adapter = new ListSourceDataAdapter();
    adapter.DataSource = data;
    adapter.Mappings.Latitude = "Latitude";
    adapter.Mappings.Longitude = "Longitude";
    adapter.DefaultMapItemType = MapItemType.Dot;
    adapter.PropertyMappings.Add(
        new MapDotSizeMapping() { DefaultValue = 10 }
    );
    vectorLayer.Data = adapter;
    vectorLayer.ItemStyle.Fill = Color.FromArgb(74, 212, 255);
    vectorLayer.ItemStyle.Stroke = Color.Gray;

    miniMap.Layers.Add(mapLayer);
    miniMap.Layers.Add(vectorLayer);
    return miniMap;
}
vb
mapControl.MiniMap = CreateMiniMap(data)
Private Function CreateMiniMap(ByVal data As Object) As MiniMap

    Dim miniMap As New MiniMap() With { _
        .Height = 200, .Width = 300, .Behavior = New FixedMiniMapBehavior() With {.CenterPoint = New GeoPoint(-35, 140), .ZoomLevel = 3} _
    }

    Dim mapLayer As New MiniMapImageTilesLayer() With { _
        .DataProvider = New BingMapDataProvider() With {.BingKey = bingKey, .Kind = BingMapKind.Area} _
    }

    Dim vectorLayer As New MiniMapVectorItemsLayer()
    Dim adapter As New ListSourceDataAdapter()
    adapter.DataSource = data
    adapter.Mappings.Latitude = "Latitude"
    adapter.Mappings.Longitude = "Longitude"
    adapter.DefaultMapItemType = MapItemType.Dot
    adapter.PropertyMappings.Add(New MapDotSizeMapping() With {.DefaultValue = 10})
    vectorLayer.Data = adapter
    vectorLayer.ItemStyle.Fill = Color.FromArgb(74, 212, 255)
    vectorLayer.ItemStyle.Stroke = Color.Gray

    miniMap.Layers.Add(mapLayer)
    miniMap.Layers.Add(vectorLayer)
    Return miniMap
End Function

Inheritance

Object DXCollectionBase<MiniMapLayerBase> DXCollection<MiniMapLayerBase> DevExpress.Utils.DXNamedItemCollection<MiniMapLayerBase> MiniMapLayerCollection

See Also

MiniMapLayerCollection Members

DevExpress.XtraMap Namespace