Skip to content

Add Map pin clustering sample for .NET MAUI 11 preview 3#743

Merged
jfversluis merged 11 commits intomainfrom
map-clustering-sample
Apr 14, 2026
Merged

Add Map pin clustering sample for .NET MAUI 11 preview 3#743
jfversluis merged 11 commits intomainfrom
map-clustering-sample

Conversation

@davidortinau
Copy link
Copy Markdown
Contributor

Summary

Adds a standalone sample demonstrating the new Map pin clustering APIs introduced in .NET MAUI 11 preview 2 (dotnet/maui#33831).

APIs demonstrated

  • Map.IsClusteringEnabled — enables automatic grouping of nearby pins
  • Pin.ClusteringIdentifier — groups pins into named clusters
  • Map.ClusterClicked — event fired when a cluster annotation is tapped
  • ClusterClickedEventArgs — exposes Pins, Location, and Handled properties

Files

  • 11.0/UserInterface/Views/Map/MapClustering/ — complete standalone project
  • Targets net11.0-android, net11.0-ios, net11.0-maccatalyst, net11.0-windows
  • Uses official 11.0.0-preview.2.26152.10 packages from NuGet.org
  • Includes docregion markers for docs snippet extraction
  • README with screenshot

Platform notes

  • iOS/Mac Catalyst: Uses native MKClusterAnnotation — full support
  • Android: Custom grid-based clustering algorithm
  • Windows: Not yet supported (Map control limitation)

Screenshot (Mac Catalyst)

Demonstrates the new Map.IsClusteringEnabled, Pin.ClusteringIdentifier,
and Map.ClusterClicked APIs introduced in .NET MAUI 11 preview 2.

- Standalone sample under 11.0/UserInterface/Views/Map/MapClustering/
- Targets net11.0-android, net11.0-ios, net11.0-maccatalyst, net11.0-windows
- Uses official 11.0.0-preview.2.26152.10 packages from NuGet.org
- Includes docregion markers for docs snippet extraction
- README with screenshot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread 11.0/UserInterface/Views/Map/images/.gitkeep Outdated
Comment thread 11.0/UserInterface/Views/Map/README.md
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 11, 2026

@davidortinau I've opened a new pull request, #746, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits March 11, 2026 12:12
* Initial plan

* Remove unnecessary .gitkeep file from images directory

Co-authored-by: davidortinau <41873+davidortinau@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: davidortinau <41873+davidortinau@users.noreply.github.com>
Include 11.0.x in the dotnet-version list for both build-all and
build-pr workflows so that net11.0-* sample projects can be built.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jfversluis jfversluis changed the title Add Map pin clustering sample for .NET MAUI 11 preview 2 Add Map pin clustering sample for .NET MAUI 11 preview 3 Mar 12, 2026
@jfversluis jfversluis marked this pull request as draft March 12, 2026 16:07
@jfversluis
Copy link
Copy Markdown
Member

This is available in preview 3, not 2. So lets park this until p3 comes out.

@davidortinau
Copy link
Copy Markdown
Contributor Author

This sample currently covers clustering only. To align with the full Preview 3 Maps feature set documented in docs-maui#3212 and the release notes (dotnet/core#10348), consider expanding to include:

  • Custom pin icons (Pin.ImageSource)
  • Custom JSON map styling (Map.MapStyle)
  • Circle/Polygon/Polyline click events
  • MapElement.IsVisible / ZIndex toggling
  • MapLongClicked event handling
  • Pin.ShowInfoWindow() / HideInfoWindow()
  • UserLocationChanged + LastUserLocation
  • Animated MoveToRegion + MapSpan.FromLocations()

Also needs package bump from preview.2 to preview.3 and undrafting when ready.

- Bump Android SupportedOSPlatformVersion 21→23 (Preview 3 requirement)
- Update packages to Preview 3: Controls via workload, Maps via CI build with clustering APIs
- Update Microsoft.Extensions.Logging.Debug to preview 3

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jfversluis jfversluis marked this pull request as ready for review April 14, 2026 19:11
jfversluis and others added 2 commits April 14, 2026 21:11
- Custom pin icons via Pin.ImageSource
- MapLongClicked event for interactive pin dropping
- Circle and Polygon overlay click events (CircleClicked, PolygonClicked)
- MapElement.IsVisible and ZIndex toggling
- Animated MoveToRegion with MapSpan.FromCenterAndRadius
- Bump packages to 11.0.0-preview.3.26203.7
- Add UseMauiMaps and ValidateXcodeVersion to csproj
- Update README to reflect all features
- Add docregion markers for docs snippet extraction

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jfversluis and others added 2 commits April 14, 2026 22:26
Replace hardcoded package versions with $(MauiVersion) and $(DotNetVersion).
Remove per-project ValidateXcodeVersion (inherited from Directory.Build.props).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jfversluis jfversluis merged commit 78b5efc into main Apr 14, 2026
3 checks passed
@jfversluis jfversluis deleted the map-clustering-sample branch April 14, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants