-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
Description
The Microsoft.Maui.Controls.Maps.Map control on Android has two related bugs where changes to MAUI objects are not propagated to the native Google Map:
-
MapElements.Clear()doesn't remove native polygons - After callingClear(), the collection count becomes 0, but the polygons remain visible on the native Google Map. -
Polygon property changes don't update native polygons - Changing
FillColororStrokeColor(e.g., setting alpha to 0) updates the MAUI object correctly, but the native Google Map polygon is not updated.
Both bugs appear to be in MapElementHandler which is not forwarding changes to the native platform.
Steps to Reproduce
BUG 1: Clear() doesn't remove native polygons
- Add polygons to
Map.MapElements - Call
Map.MapElements.Clear() - Observe:
MapElements.Countis 0, but polygons are still visible
BUG 2: Property changes don't sync
- Add polygons to
Map.MapElements - Set
polygon.FillColorto a color with alpha = 0 - Observe:
polygon.FillColor.Alphais 0.00, but polygon is still visible
Link to public reproduction project repository
https://github.com/TimZander/MauiMapOpacityDemo
Version with bug
9.0.0 GA
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android API 34
Did you find any workaround?
No. Tested workarounds that all failed:
Handler?.DisconnectHandler()before Clear()- Toggle
Map.IsVisible - Cycle
Map.MapType - Move map far away with
MoveToRegion() - Remove elements one-by-one instead of Clear()
- Set polygon colors to transparent
Relevant log output
After adding polygons and setting alpha to 0, diagnostics show MAUI state is correct but native isn't updated:
=== DIAGNOSTICS ===
MapElements.Count: 3
Map.Handler: MapHandler
[0] Polygon:
FillColor: R=1.00 G=0.00 B=0.00 A=0.00 <-- Alpha is 0, but polygon still visible!
StrokeColor: R=0.55 G=0.00 B=0.00 A=0.00
Handler: MapElementHandler
[1] Polygon:
FillColor: R=0.00 G=1.00 B=0.00 A=0.00
StrokeColor: R=0.00 G=0.39 B=0.00 A=0.00
Handler: MapElementHandler