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 calling Clear(), the collection count becomes 0, but the polygons remain visible on the native Google Map.
-
Polygon property changes don't update native polygons - Changing FillColor or StrokeColor (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.Count is 0, but polygons are still visible
BUG 2: Property changes don't sync
- Add polygons to
Map.MapElements
- Set
polygon.FillColor to a color with alpha = 0
- Observe:
polygon.FillColor.Alpha is 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
Description
Description
The
Microsoft.Maui.Controls.Maps.Mapcontrol 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
MapElementHandlerwhich is not forwarding changes to the native platform.Steps to Reproduce
BUG 1: Clear() doesn't remove native polygons
Map.MapElementsMap.MapElements.Clear()MapElements.Countis 0, but polygons are still visibleBUG 2: Property changes don't sync
Map.MapElementspolygon.FillColorto a color with alpha = 0polygon.FillColor.Alphais 0.00, but polygon is still visibleLink 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()Map.IsVisibleMap.MapTypeMoveToRegion()Relevant log output