MiniMap Class
This class allows showing the mini map on the MapControl.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v18.1.dll
Declaration
public class MiniMap :
MapDisposableObject,
IOwnedElement,
IMapView,
IRenderMiniMapContentProvider,
IRenderContextProvider,
IRenderStyleProvider,
ISupportUnitConverter,
IUIThreadRunner,
IServiceProvider,
IMapStyleOwner,
IRenderContextCreator,
IDesignTimeItem,
IUpdateSupportItem
Related API Members
The following members accept/return MiniMap objects:
Example
To add a mini map to a map, do the following.
- Create a MiniMap object.
- Specify the parameters of the mini map.
- Assign it to the MapControl.MiniMap property.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/xtramap-getting-started-lesson-3-binding-a-map-control-to-data-loaded-from-xml-e4687
object data = LoadData(xmlFilepath);
// Create a map and data for it.
MapControl map = new MapControl() {
CenterPoint = new GeoPoint(-37.2, 143.2),
ZoomLevel = 5,
Dock = DockStyle.Fill,
ToolTipController = new ToolTipController() { AllowHtmlText = true },
ImageList = LoadImage(imageFilepath)
};
this.Controls.Add(map);
// Create a mini map and data for it.
MiniMap miniMap = new MiniMap() {
Alignment = MiniMapAlignment.BottomLeft
};
miniMap.Layers.Add(new MiniMapImageTilesLayer() {
DataProvider = new BingMapDataProvider() { BingKey = bingKey }
});
miniMap.Layers.Add(new MiniMapVectorItemsLayer() { Data = CreateMiniMapAdapter(data) });
map.MiniMap = miniMap;
// Creates an adapter for the mini map's vector layer.
private IMapDataAdapter CreateMiniMapAdapter(object source) {
ListSourceDataAdapter adapter = new ListSourceDataAdapter();
adapter.DataSource = source;
adapter.Mappings.Latitude = "Latitude";
adapter.Mappings.Longitude = "Longitude";
adapter.PropertyMappings.Add(new MapItemFillMapping() { DefaultValue = Color.Red });
adapter.PropertyMappings.Add(new MapItemStrokeMapping() { DefaultValue = Color.White });
adapter.PropertyMappings.Add(new MapItemStrokeWidthMapping() { DefaultValue = 2 });
adapter.PropertyMappings.Add(new MapDotSizeMapping() { DefaultValue = 8 });
adapter.DefaultMapItemType = MapItemType.Dot;
return adapter;
}
// Loads data from a XML file.
private DataTable LoadData(string path) {
DataSet ds = new DataSet();
ds.ReadXml(path);
DataTable table = ds.Tables[0];
return table;
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the MiniMap class.
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.