Mapsui MAUI getting started
Step 1
Create a new .NET 7.0 MAUI application in Visual Studio.
Step 2
In the package manager console type:
PM> Install-Package Mapsui.Maui -pre
Step 3
IMPORTANT: In MauiProgram.cs add .UseSkiaSharp() to the builder like this:
builder
.UseMauiApp<App>()
.UseSkiaSharp(true)
.ConfigureFonts(fonts =>
and add namespace 'SkiaSharp.Views.Maui.Controls.Hosting':
using SkiaSharp.Views.Maui.Controls.Hosting;
This is because Mapsui depends on SkiaSharp which needs this call. We hope that this will not be necessary in a future version of Mapsui.Maui. Without this line the app will crash with this exception: Catastrophic failure (0x8000FFFF (E_UNEXPECTED))
on Windows and with Microsoft.Mapsui.Platform.HandlerNotFoundException has been thrown
on Mac.
Step 4
In MainPage.xaml.cs replace the constuctor with this code:
public MainPage()
{
InitializeComponent();
var mapControl = new Mapsui.UI.Maui.MapControl();
mapControl.Map?.Layers.Add(Mapsui.Tiling.OpenStreetMap.CreateTileLayer());
Content = mapControl;
}
Step 5
Run it and you should see a map of the world.