A newer version of this page is available. Switch to the current version.

MiniMap Class

This class allows showing the mini map on the MapControl.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v19.1.dll

Declaration

public class MiniMap :
    MapDisposableObject,
    IOwnedElement,
    IMapView,
    IMapViewCore,
    ICoordinateSystemProvider,
    IRenderMiniMapContentProvider,
    IRenderContextProvider,
    IRenderStyleProvider,
    IUIThreadRunner,
    IServiceProvider,
    IMapStyleOwner,
    IRenderContextCreator,
    IDesignTimeItem,
    IUpdateSupportItem,
    IUnitConverterProvider
Public Class MiniMap
    Inherits MapDisposableObject
    Implements IOwnedElement,
               IMapView,
               IMapViewCore,
               ICoordinateSystemProvider,
               IRenderMiniMapContentProvider,
               IRenderContextProvider,
               IRenderStyleProvider,
               IUIThreadRunner,
               IServiceProvider,
               IMapStyleOwner,
               IRenderContextCreator,
               IDesignTimeItem,
               IUpdateSupportItem,
               IUnitConverterProvider

Related API Members

The following members accept/return MiniMap objects:

Examples

TIP

The complete sample project is available on GitHub.

To add a mini map to a map, do the following.

// In the Form's constructor.
object data = LoadData(@"..\..\Data\Ships.xml");

// Create a mini map and data for it.
MiniMap miniMap = new MiniMap();
miniMap.Alignment = MiniMapAlignment.BottomLeft;
miniMap.Layers.AddRange(new MiniMapLayerBase[] {
    new MiniMapImageTilesLayer() {
        DataProvider = new BingMapDataProvider() {
            BingKey = "YOUR_BING_MAPS_KEY_HERE"
        }
    },
    new MiniMapVectorItemsLayer() {
        Data = CreateMiniMapAdapter(data)
    }
});
map.MiniMap = miniMap;


// Creates an adapter for the map's vector layer.
private IMapDataAdapter CreateAdapter(object source) {
    ListSourceDataAdapter adapter = new ListSourceDataAdapter();

    adapter.DataSource = source;

    adapter.Mappings.Latitude = "Latitude";
    adapter.Mappings.Longitude = "Longitude";

    adapter.AttributeMappings.Add(new MapItemAttributeMapping() { Member = "Name", Name = "Name" });
    adapter.AttributeMappings.Add(new MapItemAttributeMapping() { Member = "Year", Name = "Year" });
    adapter.AttributeMappings.Add(new MapItemAttributeMapping() { Member = "Description", Name = "Description" });

    return adapter;
}

// Loads data from a XML file.
private List<ShipwreckData> LoadData(string path) {
    return XDocument.Load(path).Element("Ships").Elements("Ship")
        .Select(e => new ShipwreckData(
            year: Convert.ToInt32(e.Element("Year").Value, CultureInfo.InvariantCulture),
            name: e.Element("Name").Value,
            description: e.Element("Description").Value,
            latitude: Convert.ToDouble(e.Element("Latitude").Value, CultureInfo.InvariantCulture),
            longitude: Convert.ToDouble(e.Element("Longitude").Value, CultureInfo.InvariantCulture)
        ))
        .ToList();
}

public class ShipwreckData {
    public int Year { get; }
    public string Name { get; }
    public string Description { get; }
    public double Latitude { get; }
    public double Longitude { get; }

    public ShipwreckData(int year, string name, string description, double latitude, double longitude) {
        this.Year = year;
        this.Name = name;
        this.Description = description;
        this.Latitude = latitude;
        this.Longitude = longitude;
    }
}

Inheritance

See Also