judero01col / GMap.NET

GMap.NET Windows Forms & Presentation is an excellent open source, powerful, free and cross-platform .NET control. Allows the use of routing, geocoding, directions and maps from Google, Yahoo!, Bing, OpenStreetMap, ArcGIS, Pergo, SigPac, Yendux, Mapy.cz, Maps.lt, iKarte.lv, NearMap, HereMap, CloudMade, WikiMapia, MapQuest and many more.
Other
458 stars 201 forks source link

GMap.NET.Avalonia markers are not shown #178

Open hangdog78 opened 1 year ago

hangdog78 commented 1 year ago

GMap.NET.Avalonia markers are not shown after adding to Markers collection. Any ideas why?

Example of code: newpoint - marker coords. Map - GMap control

GMapMarker iconmarker = new GMapMarker(new PointLatLng(newpoint.Lat, newpoint.Lng));
iconmarker.Shape = new Ellipse() { Width = 100, Height = 100, Fill = Brushes.Green, Stroke =Brushes.Red};

Map.Markers.Add(iconmarker);

Marker is in collection, but not shown =((

And because of use user32.dll for mouse cursor positioning, have to set MouseWheelZoomEnabled to False, or u catch exception under Unix.

alex-valchuk commented 3 months ago

Looks like GMapControl for Avalonia UI never worked properly. I tried to debug it checking it under the hood and found the following: at least the xaml template used inside GMapControl is not compatible with avalonia. Here is how it looks like (just a copy of WPF version):

And here is what is expected to be (ItemContainerTheme instead of ItemContainerStyle):

It seems like the ItemsControl (the parent class of GMapControl) behaves differently in comparison to one from WPF and it does not allow to map the data using the provided template. I tried to map the data on the pure Avalonia ItemsControl with the provided template and saw it working.

So, the question is how to instruct the control that inherits from Avalonia ItemsControl to display items using the provided custom template?

I address the last question to the main Avalonia UI contributors. Maybe they can help us somehow to progress with this issue. @MikeCodesDotNET, @kekekeks, @MrJul, @grokys, @maxkatz6