Skip to content

MapView

Namespace: ThinkGeo.UI.XamarinForms

This class represents the map control.

public class MapView : Xamarin.Forms.View, System.ComponentModel.INotifyPropertyChanged, Xamarin.Forms.Internals.IDynamicResourceHandler, Xamarin.Forms.IElement, Xamarin.Forms.Internals.INameScope, Xamarin.Forms.IElementController, Xamarin.Forms.StyleSheets.IStyleSelectable, Xamarin.Forms.Internals.INavigationProxy, Xamarin.Forms.IAnimatable, Xamarin.Forms.IVisualElementController, Xamarin.Forms.IResourcesProvider, Xamarin.Forms.IStyleElement, Xamarin.Forms.IFlowDirectionController, Xamarin.Forms.IPropertyPropagationController, Xamarin.Forms.IVisualController, Xamarin.Forms.ITabStopElement, Xamarin.Forms.StyleSheets.IStylable, Xamarin.Forms.IViewController, Xamarin.Forms.Internals.IGestureController, Xamarin.Forms.IGestureRecognizers, ThinkGeo.UI.XamarinForms.Adapters.IMapElementAdaptable`1[[ThinkGeo.UI.XamarinForms.Adapters.IMapViewAdapter, ThinkGeo.UI.XamarinForms, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null]], System.IDisposable

Inheritance Object → BindableObject → Element → NavigableElement → VisualElement → View → MapView
Implements INotifyPropertyChanged, IDynamicResourceHandler, IElement, INameScope, IElementController, IStyleSelectable, INavigationProxy, IAnimatable, IVisualElementController, IResourcesProvider, IStyleElement, IFlowDirectionController, IPropertyPropagationController, IVisualController, ITabStopElement, IStylable, IViewController, IGestureController, IGestureRecognizers, IMapElementAdaptable<IMapViewAdapter>, IDisposable

Remarks:

The map class inherits from the View, so it can be dragged onto the page or be created and added to a contoller via code like the popular control itself. You also need to configure the properties of the map. The most important step is adding overlays, which generate images and stack them over each other to form a map image. The map control has many methods and events through which you can interact with the map.

Properties

DisplayDensity

Gets the display density.

public float DisplayDensity { get; }

Property Value

Single
The display density.

AdornmentOverlay

Gets or sets the adornment overlay.

public AdornmentOverlay AdornmentOverlay { get; set; }

Property Value

AdornmentOverlay
The adornment overlay.

Adapter

Gets the adapter density.

public IMapViewAdapter Adapter { get; set; }

Property Value

IMapViewAdapter
The Adapter.

MapUnit

Gets or sets the map unit used by the MapControl.

public GeographyUnit MapUnit { get; set; }

Property Value

GeographyUnit

Remarks:

The MapUnit reflects the data unit.

MinimumScale

public double MinimumScale { get; set; }

Property Value

Double

MaximumScale

public double MaximumScale { get; set; }

Property Value

Double

MapRotation

public double MapRotation { get; set; }

Property Value

Double

CenterPoint

public PointShape CenterPoint { get; set; }

Property Value

PointShape

MapScale

public double MapScale { get; set; }

Property Value

Double

RotationEnabled

public bool RotationEnabled { get; set; }

Property Value

Boolean

MapTools

Gets a object for simply using MapTools.

public MapTools MapTools { get; }

Property Value

MapTools
The map tools.

TrackOverlay

Gets or sets the track overlay in the MapControl.

public TrackInteractiveOverlay TrackOverlay { get; }

Property Value

TrackInteractiveOverlay

EditOverlay

Gets or sets the edit overlay in the MapControl.

public EditInteractiveOverlay EditOverlay { get; }

Property Value

EditInteractiveOverlay

ExtentOverlay

public ExtentInteractiveOverlay ExtentOverlay { get; }

Property Value

ExtentInteractiveOverlay

CurrentExtent

Gets or sets the current extent of the MapControl.

public RectangleShape CurrentExtent { get; set; }

Property Value

RectangleShape

Remarks:

The current extent stands for the extent of current position, this is very important metrics to caculate the scale.

Overlays

This property gets the collection of Overlays in the MapControl.

public GeoCollection<Overlay> Overlays { get; }

Property Value

GeoCollection<Overlay>

ZoomLevelSet

This property gets or sets the ZoomLevelSet used for the MapView control.

public ZoomLevelSet ZoomLevelSet { get; set; }

Property Value

ZoomLevelSet

GestureRecognizers

public IList<IGestureRecognizer> GestureRecognizers { get; }

Property Value

IList<IGestureRecognizer>

HorizontalOptions

public LayoutOptions HorizontalOptions { get; set; }

Property Value

LayoutOptions

Margin

public Thickness Margin { get; set; }

Property Value

Thickness

VerticalOptions

public LayoutOptions VerticalOptions { get; set; }

Property Value

LayoutOptions

Visual

public IVisual Visual { get; set; }

Property Value

IVisual

FlowDirection

public FlowDirection FlowDirection { get; set; }

Property Value

FlowDirection

AnchorX

public double AnchorX { get; set; }

Property Value

Double

AnchorY

public double AnchorY { get; set; }

Property Value

Double

BackgroundColor

public Color BackgroundColor { get; set; }

Property Value

Color

Background

public Brush Background { get; set; }

Property Value

Brush

Behaviors

public IList<Behavior> Behaviors { get; }

Property Value

IList<Behavior>

Bounds

public Rectangle Bounds { get; }

Property Value

Rectangle

Height

public double Height { get; }

Property Value

Double

HeightRequest

public double HeightRequest { get; set; }

Property Value

Double

InputTransparent

public bool InputTransparent { get; set; }

Property Value

Boolean

IsEnabled

public bool IsEnabled { get; set; }

Property Value

Boolean

IsFocused

public bool IsFocused { get; }

Property Value

Boolean

IsVisible

public bool IsVisible { get; set; }

Property Value

Boolean

MinimumHeightRequest

public double MinimumHeightRequest { get; set; }

Property Value

Double

MinimumWidthRequest

public double MinimumWidthRequest { get; set; }

Property Value

Double

Opacity

public double Opacity { get; set; }

Property Value

Double

Rotation

public double Rotation { get; set; }

Property Value

Double

RotationX

public double RotationX { get; set; }

Property Value

Double

RotationY

public double RotationY { get; set; }

Property Value

Double

Scale

public double Scale { get; set; }

Property Value

Double

ScaleX

public double ScaleX { get; set; }

Property Value

Double

ScaleY

public double ScaleY { get; set; }

Property Value

Double

TabIndex

public int TabIndex { get; set; }

Property Value

Int32

IsTabStop

public bool IsTabStop { get; set; }

Property Value

Boolean

TranslationX

public double TranslationX { get; set; }

Property Value

Double

TranslationY

public double TranslationY { get; set; }

Property Value

Double

Triggers

public IList<TriggerBase> Triggers { get; }

Property Value

IList<TriggerBase>

Width

public double Width { get; }

Property Value

Double

WidthRequest

public double WidthRequest { get; set; }

Property Value

Double

X

public double X { get; }

Property Value

Double

Y

public double Y { get; }

Property Value

Double

Clip

public Geometry Clip { get; set; }

Property Value

Geometry

Batched

public bool Batched { get; }

Property Value

Boolean

DisableLayout

public bool DisableLayout { get; set; }

Property Value

Boolean

IsInNativeLayout

public bool IsInNativeLayout { get; set; }

Property Value

Boolean

IsNativeStateConsistent

public bool IsNativeStateConsistent { get; set; }

Property Value

Boolean

IsPlatformEnabled

public bool IsPlatformEnabled { get; set; }

Property Value

Boolean

Resources

public ResourceDictionary Resources { get; set; }

Property Value

ResourceDictionary

public INavigation Navigation { get; internal set; }

Property Value

INavigation

Style

public Style Style { get; set; }

Property Value

Style

StyleClass

public IList<string> StyleClass { get; set; }

Property Value

IList<String>

class

public IList<string> class { get; set; }

Property Value

IList<String>

public NavigationProxy NavigationProxy { get; }

Property Value

NavigationProxy

AutomationId

public string AutomationId { get; set; }

Property Value

String

ClassId

public string ClassId { get; set; }

Property Value

String

Effects

public IList<Effect> Effects { get; }

Property Value

IList<Effect>

Id

public Guid Id { get; }

Property Value

Guid

ParentView

public VisualElement ParentView { get; }

Property Value

VisualElement

StyleId

public string StyleId { get; set; }

Property Value

String

LogicalChildren

public ReadOnlyCollection<Element> LogicalChildren { get; }

Property Value

ReadOnlyCollection<Element>

RealParent

public Element RealParent { get; }

Property Value

Element

Parent

public Element Parent { get; set; }

Property Value

Element

EffectControlProvider

public IEffectControlProvider EffectControlProvider { get; set; }

Property Value

IEffectControlProvider

Platform

public IPlatform Platform { get; set; }

Property Value

IPlatform

Dispatcher

public IDispatcher Dispatcher { get; internal set; }

Property Value

IDispatcher

BindingContext

public object BindingContext { get; set; }

Property Value

Object

Constructors

MapView()

Initializes a new instance of the MapView class.

public MapView()

Methods

OnCurrentExtentChanging(CurrentExtentChangingMapViewEventArgs)

protected void OnCurrentExtentChanging(CurrentExtentChangingMapViewEventArgs e)

Parameters

e CurrentExtentChangingMapViewEventArgs

OnCurrentExtentChanged(CurrentExtentChangedMapViewEventArgs)

protected void OnCurrentExtentChanged(CurrentExtentChangedMapViewEventArgs e)

Parameters

e CurrentExtentChangedMapViewEventArgs

OnCurrentScaleChanging(CurrentScaleChangingMapViewEventArgs)

protected void OnCurrentScaleChanging(CurrentScaleChangingMapViewEventArgs e)

Parameters

e CurrentScaleChangingMapViewEventArgs

OnCurrentScaleChanged(CurrentScaleChangedMapViewEventArgs)

protected void OnCurrentScaleChanged(CurrentScaleChangedMapViewEventArgs e)

Parameters

e CurrentScaleChangedMapViewEventArgs

OnMapLongPress(TouchMapViewEventArgs)

protected void OnMapLongPress(TouchMapViewEventArgs e)

Parameters

e TouchMapViewEventArgs

OnMapSingleTap(TouchMapViewEventArgs)

protected void OnMapSingleTap(TouchMapViewEventArgs e)

Parameters

e TouchMapViewEventArgs

OnMapDoubleTap(TouchMapViewEventArgs)

protected void OnMapDoubleTap(TouchMapViewEventArgs e)

Parameters

e TouchMapViewEventArgs

OnMapTouchMove(TouchMapViewEventArgs)

protected void OnMapTouchMove(TouchMapViewEventArgs e)

Parameters

e TouchMapViewEventArgs

OnMapTouchUp(TouchMapViewEventArgs)

protected void OnMapTouchUp(TouchMapViewEventArgs e)

Parameters

e TouchMapViewEventArgs

OnMapTouchDown(TouchMapViewEventArgs)

protected void OnMapTouchDown(TouchMapViewEventArgs e)

Parameters

e TouchMapViewEventArgs

OnCollectedMapArguments(CollectedMapArgumentsMapViewEventArgs)

protected void OnCollectedMapArguments(CollectedMapArgumentsMapViewEventArgs e)

Parameters

e CollectedMapArgumentsMapViewEventArgs

FindFeatureLayer(String)

Finds the feature layer.

public FeatureLayer FindFeatureLayer(string layerKey)

Parameters

layerKey String
The layer key.

Returns

FeatureLayer
FeatureLayer.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Finalize()

Finalizes an instance of the MapView class.

protected void Finalize()

Dispose(Boolean)

Releases unmanaged and - optionally - managed resources.

protected void Dispose(bool disposing)

Parameters

disposing Boolean
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Refresh()

This method will simulate the Refresh interaction. Refreshes current map control.

public void Refresh()

Remarks:

Refreshes all the existing overlays and map tools.

RefreshAsync()

This method will simulate the Refresh interaction. Refreshes current map control.

public Task RefreshAsync()

Returns

Task

Remarks:

Refreshes all the existing overlays and map tools.

Refresh(IEnumerable<Overlay>)

This method will simulate the Refresh interaction. Refreshes a specified overlay collection.

public void Refresh(IEnumerable<Overlay> overlays)

Parameters

overlays IEnumerable<Overlay>
A collection of overlay to be refreshed.

RefreshAsync(IEnumerable<Overlay>)

This method will simulate the Refresh interaction. Refreshes a specified overlay collection.

public Task RefreshAsync(IEnumerable<Overlay> overlays)

Parameters

overlays IEnumerable<Overlay>
A collection of overlay to be refreshed.

Returns

Task

Refresh(Overlay)

This method will simulate the Refresh interaction. Refreshes a specified overlay.

public void Refresh(Overlay overlay)

Parameters

overlay Overlay
Overlay to be refreshed.

RefreshAsync(Overlay)

This method will simulate the Refresh interaction. Refreshes a specified overlay.

public Task RefreshAsync(Overlay overlay)

Parameters

overlay Overlay
Overlay to be refreshed.

Returns

Task

CenterAt(PointShape)

Locates the map center to the specified world point.

public void CenterAt(PointShape worldCenter)

Parameters

worldCenter PointShape
A world point to locate the map.

CenterAtAsync(PointShape)

Locates the map center to the specified world point.

public Task CenterAtAsync(PointShape worldCenter)

Parameters

worldCenter PointShape
A world point to locate the map.

Returns

Task

CenterAt(Feature)

Locates the map center to the center point of the given feature.

public void CenterAt(Feature feature)

Parameters

feature Feature
A feature to locate the map.

CenterAtAsync(Feature)

Locates the map center to the center point of the given feature.

public Task CenterAtAsync(Feature feature)

Parameters

feature Feature
A feature to locate the map.

Returns

Task

CenterAt(Double, Double)

Locates the map center to the worldX and worldY.

public void CenterAt(double worldX, double worldY)

Parameters

worldX Double
The x of the world point.

worldY Double
The y of the world point.

CenterAtAsync(Double, Double)

Locates the map center to the worldX and worldY.

public Task CenterAtAsync(double worldX, double worldY)

Parameters

worldX Double
The x of the world point.

worldY Double
The y of the world point.

Returns

Task

Pan(PanDirection, Int32)

public void Pan(PanDirection direction, int percentage)

Parameters

direction PanDirection

percentage Int32

PanAsync(PanDirection, Int32)

public Task PanAsync(PanDirection direction, int percentage)

Parameters

direction PanDirection

percentage Int32

Returns

Task

Pan(Single, Int32)

public void Pan(float degree, int percentage)

Parameters

degree Single

percentage Int32

PanAsync(Single, Int32)

public Task PanAsync(float degree, int percentage)

Parameters

degree Single

percentage Int32

Returns

Task

Pan(Single, Single)

public void Pan(float offsetScreenX, float offsetScreenY)

Parameters

offsetScreenX Single

offsetScreenY Single

PanAsync(Single, Single)

public Task PanAsync(float offsetScreenX, float offsetScreenY)

Parameters

offsetScreenX Single

offsetScreenY Single

Returns

Task

ZoomIn()

Zooms the map in for one level.

public void ZoomIn()

ZoomInAsync()

public Task ZoomInAsync()

Returns

Task

ZoomIn(Int32)

public void ZoomIn(int percentage)

Parameters

percentage Int32

ZoomInAsync(Int32)

public Task ZoomInAsync(int percentage)

Parameters

percentage Int32

Returns

Task

ZoomOut()

Zooms the map out for one level.

public void ZoomOut()

ZoomOutAsync()

public Task ZoomOutAsync()

Returns

Task

ZoomOut(Int32)

public void ZoomOut(int percentage)

Parameters

percentage Int32

ZoomOutAsync(Int32)

public Task ZoomOutAsync(int percentage)

Parameters

percentage Int32

Returns

Task

ZoomInByAnchorPoint(ScreenPointF)

public void ZoomInByAnchorPoint(ScreenPointF touchPosition)

Parameters

touchPosition ScreenPointF

ZoomInByAnchorPointAsync(ScreenPointF)

public Task ZoomInByAnchorPointAsync(ScreenPointF touchPosition)

Parameters

touchPosition ScreenPointF

Returns

Task

ZoomTo(BaseShape)

This method zooms current map to the target shape.

public void ZoomTo(BaseShape targetExtent)

Parameters

targetExtent BaseShape
A rectangle shape to locates the map.

Remarks:

When calling this method, it doesn't refresh existing Tiles on the current map. For example, if using a TileOverlay such as LayerOverlay; a layer style is changed, Refresh method is proper to call.

ZoomToAsync(BaseShape)

This method zooms current map to the target shape.

public Task ZoomToAsync(BaseShape targetExtent)

Parameters

targetExtent BaseShape
A rectangle shape to locates the map.

Returns

Task

Remarks:

When calling this method, it doesn't refresh existing Tiles on the current map. For example, if using a TileOverlay such as LayerOverlay; a layer style is changed, Refresh method is proper to call.

ZoomTo(Feature)

This method zooms current map to the specified feature.

public void ZoomTo(Feature feature)

Parameters

feature Feature
A feature to locates the map.

Remarks:

When calling this method, it doesn't refresh existing Tiles on the current map. For example, if using a TileOverlay such as LayerOverlay; a layer style is changed, Refresh method is proper to call.

ZoomToAsync(Feature)

This method zooms current map to the specified feature.

public Task ZoomToAsync(Feature feature)

Parameters

feature Feature
A feature to locates the map.

Returns

Task

Remarks:

When calling this method, it doesn't refresh existing Tiles on the current map. For example, if using a TileOverlay such as LayerOverlay; a layer style is changed, Refresh method is proper to call.

ZoomTo(PointShape, Double)

This method zooms current map to a specified position and scale.

public void ZoomTo(PointShape worldCenter, double targetScale)

Parameters

worldCenter PointShape
A world center to zoom the map to.

targetScale Double
A double value indicates the scale to zoom the map to.

Remarks:

When calling this method, it doesn't refresh existing Tiles on the current map. For example, if using a TileOverlay such as LayerOverlay; a layer style is changed, Refresh method is proper to call.

ZoomToAsync(PointShape, Double)

This method zooms current map to a specified position and scale.

public Task ZoomToAsync(PointShape worldCenter, double targetScale)

Parameters

worldCenter PointShape
A world center to zoom the map to.

targetScale Double
A double value indicates the scale to zoom the map to.

Returns

Task

Remarks:

When calling this method, it doesn't refresh existing Tiles on the current map. For example, if using a TileOverlay such as LayerOverlay; a layer style is changed, Refresh method is proper to call.

ZoomToScale(Double)

Zooms the map to a provided scale. This method will simulate the ZoomToScale interaction.

public void ZoomToScale(double targetScale)

Parameters

targetScale Double
A target scale to zoom the map.

ZoomToScaleAsync(Double)

Zooms the map to a provided scale. This method will simulate the ZoomToScale interaction.

public Task ZoomToScaleAsync(double targetScale)

Parameters

targetScale Double
A target scale to zoom the map.

Returns

Task

ZoomToPreviousExtent()

Zooms to previous extent.

public void ZoomToPreviousExtent()

ZoomToPreviousExtentAsync()

Zooms to previous extent.

public Task ZoomToPreviousExtentAsync()

Returns

Task

ZoomToNextExtent()

Zooms to next extent.

public void ZoomToNextExtent()

ZoomToNextExtentAsync()

Zooms to next extent.

public Task ZoomToNextExtentAsync()

Returns

Task

Events

MapLongPress

Occurs when [map long press].

public event EventHandler<TouchMapViewEventArgs> MapLongPress;

MapSingleTap

Occurs when [map single tap].

public event EventHandler<TouchMapViewEventArgs> MapSingleTap;

MapDoubleTap

Occurs when [map double tap].

public event EventHandler<TouchMapViewEventArgs> MapDoubleTap;

MapTouchMove

Occurs when [map touch move].

public event EventHandler<TouchMapViewEventArgs> MapTouchMove;

MapTouchUp

Occurs when [map touch up].

public event EventHandler<TouchMapViewEventArgs> MapTouchUp;

MapTouchDown

Occurs when [map touch down].

public event EventHandler<TouchMapViewEventArgs> MapTouchDown;

CurrentExtentChanging

Occurs before map's extent is changing.

public event EventHandler<CurrentExtentChangingMapViewEventArgs> CurrentExtentChanging;

CurrentExtentChanged

Occurs after map's extent is changed.

public event EventHandler<CurrentExtentChangedMapViewEventArgs> CurrentExtentChanged;

CurrentScaleChanging

Occurs before map's current scale is changing.

public event EventHandler<CurrentScaleChangingMapViewEventArgs> CurrentScaleChanging;

CurrentScaleChanged

Occurs after map's current scale is changed.

public event EventHandler<CurrentScaleChangedMapViewEventArgs> CurrentScaleChanged;

CollectedMapArguments

Occurs after collected MapArguments.

public event EventHandler<CollectedMapArgumentsMapViewEventArgs> CollectedMapArguments;

ChildrenReordered

public event EventHandler ChildrenReordered;

Focused

public event EventHandler<FocusEventArgs> Focused;

MeasureInvalidated

public event EventHandler MeasureInvalidated;

SizeChanged

public event EventHandler SizeChanged;

Unfocused

public event EventHandler<FocusEventArgs> Unfocused;

BatchCommitted

public event EventHandler<EventArg<VisualElement>> BatchCommitted;

FocusChangeRequested

public event EventHandler<FocusRequestArgs> FocusChangeRequested;

ChildAdded

public event EventHandler<ElementEventArgs> ChildAdded;

ChildRemoved

public event EventHandler<ElementEventArgs> ChildRemoved;

DescendantAdded

public event EventHandler<ElementEventArgs> DescendantAdded;

DescendantRemoved

public event EventHandler<ElementEventArgs> DescendantRemoved;

PlatformSet

public event EventHandler PlatformSet;

PropertyChanged

public event PropertyChangedEventHandler PropertyChanged;

PropertyChanging

public event PropertyChangingEventHandler PropertyChanging;

BindingContextChanged

public event EventHandler BindingContextChanged;