Search Results for

    Show / Hide Table of Contents

    Mapsui Avalonia getting started

    Step 0

    Install the Avalonia templates:

    dotnet new install Avalonia.Templates
    

    Step 1

    Create a new Avalonia project:

    dotnet new avalonia.app -o MyApp
    

    Step 2

    Add the Mapsui.Avalonia nuget package:

    dotnet add MyApp package Mapsui.Avalonia
    

    Step 3

    In MainWindow.axaml.cs add this to the constructor after InitializeComponent():

    var mapControl = new Mapsui.UI.Avalonia.MapControl();
    mapControl.Map?.Layers.Add(Mapsui.Tiling.OpenStreetMap.CreateTileLayer());
    Content = mapControl;
    

    Step 4

    Run it and you should see a map of the world.

    cd MyApp
    dotnet run
    
    • Edit this page
    In this article
    Back to top Generated by DocFX