Skip to content

v5.0 Upgrade Guide

By compile error

Below is a list of compile error that you could encounter when upgrading van Mapsui V4 to V5. Please inform us if you run into compile errors that are not in this list.

'Layer' does not contain a definition for 'IsMapInfoLayer'
This was deprecated. instead call GetMapInfo on the EventArgs and supply the list of layers you want MapInfo of. Here is the documentation on MapInfo.

'Map' does not contain a definition for 'Home'
In V5 you can call the Navigator methods to specify the startup view, for instance: Map.Navigator.ZoomToBox(startupBox). The Home method solved a problem where you could not use the Navigator when the Map size was not initialized. In V5 this problem is solved within the Navigator by postponing the call until it is initialized.

The type or namespace name 'RectFeature' could not be found
RectFeature was removed to simplify our code. Use new GeometryFeature(myRect.ToPolygon()) instead.

'SymbolStyle' does not contain a definition for 'BitmapId' 
In V4 you had to register a bitmap and then assign the id to the SymbolStyle. In V5 you can directly specifify the path to the image source. See is the documentation on ImageSource

The name 'BitmapRegistry' does not exist in the current context
See the item above.

'MapControl' does not contain a definition for 'ScreenWidth' and no accessible extension method 'ScreenWidth' accepting a first argument of type 'MapControl' could be found
Use MapControl.Map.Navigator.Viewport.Width instead.

'MapControl' does not contain a definition for 'ScreenHeight' and no accessible extension method 'ScreenHeight' accepting a first argument of type 'MapControl' could be found
Use MapControl.Map.Navigator.Viewport.Height instead.

List of changes in the order that they were applied.

  • Removed RectFeature. Instead of new RectFeature(myRect) use new GeometryFeature(myRect.ToPolygon())
  • Removed all events from the MAUI MapControl except for MapInfo. Use gesture recognizers instead.
  • Introduced PinchState to replace separate center, radius and angle fields and used in o.a. the Map.Navigator.Pinch method.
  • Moved UnSnapRotationDegrees and UnSnapRotationDegrees properties from MapControl to MapControl.Map.Navigator.
  • Rename Microsoft.Maui.Graphics.Color ToNative(this Styles.Color color) to ToMaui.
  • Because BaseFeature is now derived from IFeature and the previously not-implemented methods and fields had to be defined as abstract, these now need the override keyword in the derived classes.
  • The logic around MapInfo was rewritten. In V4 the Info event returned a MapInfo object which contained the features on the tap location for those layers for which IsMapInfoLayer was set to true. In V5 IsMapInfoLayer is removed. The Info event args do not contain a MapInfo object but a GetMapInfo method to retrieve it. That method needs a list of layers to query. There is also a GetRemoteMapInfo for layers that get the feature info from the server, like WMS.