microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.32k stars 676 forks source link

MapControl: Cannot add MapElements #9461

Open tipa opened 6 months ago

tipa commented 6 months ago

Describe the bug

In my UWP app, I can add MapElements, to display locations (MapIcon), shapes (MapPolygon) or paths (MapPolyline), e.g. render .gpx files. This feature is missing in the WinUI3 MapControl

https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.maps.mapcontrol.mapelements?view=winrt-22621

Steps to reproduce the bug

var icon = new MapIcon { Location = myGeoPoint, NormalizedAnchorPoint = new Point(0.5, 0.5), Image = img }; myMapControl.MapElements.Add(icon);

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5.1: 1.5.240311000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

tipa commented 6 months ago

I was now able to at least find a way to add some useless marker on the map (getting used to this control isn't straight-forward, also because it is missing documentation - or I am just unable to find it).

var mapIcon = new Microsoft.UI.Xaml.Controls.MapIcon();
var pos = new Windows.Devices.Geolocation.BasicGeoposition { Latitude = 20, Longitude = 20 };
mapIcon.Location = new Windows.Devices.Geolocation.Geopoint(pos);
elem_layer.MapElements.Add(mapIcon);

But I still don't see how I could do any customization of that marker (give it a custom thumbnail or at least a title). I also don't see to add polylines or shapes

nzstevem commented 2 months ago

My app takes real time aircraft position data every second, and uses that to position a custom icon, sign posts key metrics beside the icon, and plots the historical track going back up to an hour for multiple aircraft simultaneously. It also provides a real time 3D perspective pilot view ahead as the aircraft lines up to land. If the above restrictions are correct there is no point in attempting a migration. Is there a path forward here in some reasonable timeframe?