Maps in .NET MAUI

 


Please, support my blog by clicking on our sponsors ad!

.NET MAUI in .NET 7 Release Candidate 1 release on september 20, 2022

.Net MAUI provide map control with the nugget "Microsoft.Maui.Controls.Maps".
his control is ideal for displaying and annotating maps using the native maps from each mobile platform. You can draw shapes on the map, drop pins, add custom pins, and even geocode street addresses, latitude, and longitude. To use the map control, add the NuGet package and initialize the control in your MauiProgram.
To initialize the control, add .UseMauiMaps() in your MauiProgram builder and then add the Map control to your view.
<Map x:Name="map"/>
 protected override void OnNavigatedTo(NavigatedToEventArgs args)
{
    base.OnNavigatedTo(args);

    var hanaLoc = new Location(20.7557, -155.9880);

    MapSpan mapSpan = MapSpan.FromCenterAndRadius(hanaLoc, Distance.FromKilometers(3));
    map.MoveToRegion(mapSpan);
    map.Pins.Add(new Pin
    {
        Label = "Welcome to .NET MAUI!",
        Location = hanaLoc,
    });
}  
Source: https://devblogs.microsoft.com/dotnet/dotnet-maui-in-dotnet-7-rc1/

Comments

Popular posts from this blog

Push Notifications in .NET MAUI: A Comprehensive Guide

Explore the UI libraries available for .NET MAUI at no cost.

Push Notification using Firebase in xamarin form (Android and IOS)