Add MapElement.IsVisible and MapElement.ZIndex properties#33993
Merged
jfversluis merged 4 commits intonet11.0from Feb 25, 2026
Merged
Add MapElement.IsVisible and MapElement.ZIndex properties#33993jfversluis merged 4 commits intonet11.0from
jfversluis merged 4 commits intonet11.0from
Conversation
- Add IsVisible (bool, default: true) and ZIndex (int, default: 0) to IMapElement interface - Add IsVisibleProperty and ZIndexProperty BindableProperties to MapElement - Android: Apply Visible/ZIndex on native Polygon, Polyline, Circle objects - iOS/MacCatalyst: Use Alpha 0/1 for visibility; ZIndex is no-op (MapKit limitation) - Add PropertyMapper entries in MapElementHandler - Update all 14 PublicAPI.Unshipped.txt files - Add 5 unit tests for IsVisible and ZIndex - Add MapElementVisibilityGallery sample page
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds IsVisible and ZIndex properties to all map elements (Polygon, Polyline, Circle), enabling visibility toggling and draw-order control without removing elements from the map. This is part of Phase 4 (MapElement Improvements) of the Maps Control Improvements Epic for .NET 11.
Changes:
- Adds
IsVisible(bool, default: true) andZIndex(int, default: 0) properties to theIMapElementinterface andMapElementclass - Implements platform handlers for Android (full support), iOS/MacCatalyst (visibility via Alpha, ZIndex no-op), Windows/Tizen/Standard (NotImplementedException stubs)
- Adds 5 unit tests covering default values, setters, and multi-type compatibility
- Includes sample gallery page demonstrating visibility toggles and ZIndex manipulation
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| PublicAPI.Unshipped.txt (all platforms) | Adds new public API entries for IMapElement.IsVisible, IMapElement.ZIndex, and MapElementHandler mapper methods |
| IMapElement.cs | Adds IsVisible and ZIndex interface properties with XML documentation |
| MapElement.cs | Implements IsVisible and ZIndex as BindableProperties with getters/setters |
| MapElementHandler.cs | Registers property mappers for IsVisible and ZIndex |
| MapElementHandler.Android.cs | Stub implementations (actual logic in MapHandler.Android.cs) |
| MapHandler.Android.cs | Sets Visible and ZIndex on native Android map elements (Polygon, Polyline, Circle) during creation and updates |
| MapElementHandler.iOS.cs | Implements IsVisible via Alpha (0/1), documents ZIndex no-op due to MapKit limitation |
| MapElementHandler.Windows/Tizen/Standard.cs | NotImplementedException stubs for unsupported platforms |
| MapTests.cs | 5 new unit tests for default values, setters, and cross-element-type compatibility |
| MapElementVisibilityGallery.cs | Sample page with toggle buttons and ZIndex controls |
| MapsGallery.cs | Navigation button to new sample gallery |
25 tasks
This was referenced Feb 11, 2026
Open
kubaflo
previously approved these changes
Feb 23, 2026
Resolve PublicAPI.Unshipped.txt conflicts by keeping both PR and net11.0 API entries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add missing using directives (Microsoft.Maui.Controls, Microsoft.Maui.Graphics) that caused CS0246 errors on the net11.0 (non-platform) TFM - Remove non-existent Assign() extension method call, use local variable instead - Remove duplicate PublicAPI.Unshipped.txt entries for static readonly fields (was causing RS0017 warnings) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PinItemsSourceGallery.xaml.cs defines a local Location class in the same namespace that shadows Microsoft.Maui.Devices.Sensors.Location. Use a type alias (GeoLocation) to disambiguate and add missing Microsoft.Maui using for GridLength, TextAlignment, and Thickness. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PureWeen
added a commit
that referenced
this pull request
Feb 27, 2026
…4260) This PR merges commits from `net11.0` into `release/11.0.1xx-preview2`. Commits include: - Add Circle, Polygon, and Polyline click events for Map control (#29101) - [automated] Merge branch 'main' => 'net11.0' (#34203) - Fix empty string binding to nullable value types (#33536) - Add MapElement.IsVisible and MapElement.ZIndex properties (#33993) - Add MauiXamlHotReload property for IDE communication (#34028) ## Instructions for merging Complete this PR by creating a **merge commit**, *not* a squash or rebase commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
Adds
IsVisibleandZIndexproperties to all map elements (Polygon, Polyline, Circle), enabling visibility toggling and draw-order control without removing elements from the map.Part of the Maps Control Improvements Epic: #33787 (Phase 4: MapElement Improvements)
Changes
Core Interface (
IMapElement)bool IsVisible { get; }— controls element visibility (default:true)int ZIndex { get; }— controls draw order/layering (default:0)Controls (
MapElement)IsVisiblePropertyBindableProperty (bool, default: true)ZIndexPropertyBindableProperty (int, default: 0)Platform Implementations
Android:
Polygon.Visible,Polyline.Visible,Circle.Visiblefor visibilityPolygon.ZIndex,Polyline.ZIndex,Circle.ZIndexfor draw ordermap.Add*()calls; runtime changes via*OnPropertyChangediOS/MacCatalyst:
MKOverlayRenderer.Alpha(0 = hidden, 1 = visible)Tests
Sample
Verified Working