{"id":3656,"date":"2026-03-18T18:14:35","date_gmt":"2026-03-18T18:14:35","guid":{"rendered":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2026\/03\/18\/pin-clustering-in-net-maui-maps\/"},"modified":"2026-03-18T18:14:35","modified_gmt":"2026-03-18T18:14:35","slug":"pin-clustering-in-net-maui-maps","status":"publish","type":"post","link":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2026\/03\/18\/pin-clustering-in-net-maui-maps\/","title":{"rendered":"Pin Clustering in .NET MAUI Maps"},"content":{"rendered":"<p>If you\u2019ve ever loaded a map with dozens \u2014 or hundreds \u2014 of pins, you know the result: an overlapping mess that\u2019s impossible to interact with. Starting in <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-11-preview-2\/\">.NET MAUI 11 Preview 2<\/a>, the Map control supports pin clustering out of the box on Android and iOS\/Mac Catalyst.<\/p>\n<h2>What is pin clustering?<\/h2>\n<p>Pin clustering automatically groups nearby pins into a single cluster marker when zoomed out. As you zoom in, clusters expand to reveal individual pins. This is a long-requested feature (<a href=\"https:\/\/github.com\/dotnet\/maui\/issues\/11811\">#11811<\/a>) and one that every map-heavy app needs.<\/p>\n<h2>Enable clustering<\/h2>\n<p>A single property is all it takes:<\/p>\n<pre><code class=\"language-xml\">&lt;maps:Map IsClusteringEnabled=\"True\" \/&gt;<\/code><\/pre>\n<p>That\u2019s it. Nearby pins are now grouped into clusters with a count badge showing how many pins are in each group.<\/p>\n<h2>Separate clustering groups<\/h2>\n<p>Not all pins are the same. You might want coffee shops to cluster independently from parks, or hotels separately from attractions. The <code>ClusteringIdentifier<\/code> property on <code>Pin<\/code> makes this possible:<\/p>\n<pre><code class=\"language-csharp\">map.Pins.Add(new Pin\n{\n    Label = \"Pike Place Coffee\",\n    Location = new Location(47.6097, -122.3331),\n    ClusteringIdentifier = \"coffee\"\n});\n\nmap.Pins.Add(new Pin\n{\n    Label = \"Occidental Square\",\n    Location = new Location(47.6064, -122.3325),\n    ClusteringIdentifier = \"parks\"\n});<\/code><\/pre>\n<p>Pins with the same identifier cluster together. Pins with different identifiers form independent clusters even when geographically close.<\/p>\n<h2>Handle cluster taps<\/h2>\n<p>When a user taps a cluster, the <code>ClusterClicked<\/code> event fires with a <code>ClusterClickedEventArgs<\/code> that gives you access to the pins in the cluster:<\/p>\n<pre><code class=\"language-csharp\">map.ClusterClicked += async (sender, e) =&gt;\n{\n    string names = string.Join(\"n\", e.Pins.Select(p =&gt; p.Label));\n    await DisplayAlert(\n        $\"Cluster ({e.Pins.Count} pins)\",\n        names,\n        \"OK\");\n\n    \/\/ Suppress default zoom-to-cluster behavior:\n    \/\/ e.Handled = true;\n};<\/code><\/pre>\n<p>The event args include:<\/p>\n<ul>\n<li><strong><code>Pins<\/code><\/strong> \u2014 the pins in the cluster<\/li>\n<li><strong><code>Location<\/code><\/strong> \u2014 the geographic center of the cluster<\/li>\n<li><strong><code>Handled<\/code><\/strong> \u2014 set to <code>true<\/code> if you want to handle the tap yourself instead of the default zoom behavior<\/li>\n<\/ul>\n<h2>Platform notes<\/h2>\n<p>On <strong>Android<\/strong>, clustering uses a custom grid-based algorithm that recalculates when the zoom level changes. No external dependencies are required.<\/p>\n<p>On <strong>iOS and Mac Catalyst<\/strong>, clustering leverages the native <code>MKClusterAnnotation<\/code> support in MapKit, providing smooth, platform-native cluster animations.<\/p>\n<h2>Try it out<\/h2>\n<p>The <a href=\"https:\/\/github.com\/dotnet\/maui-samples\/tree\/main\/10.0\/UserInterface\/Views\/Map\/MapDemo\/WorkingWithMaps\">Maps sample in maui-samples<\/a> includes a new <strong>Clustering<\/strong> page that demonstrates pin clustering with multiple clustering groups and cluster tap handling.<\/p>\n<p>For the full API reference and additional examples, see the <a href=\"https:\/\/learn.microsoft.com\/dotnet\/maui\/user-interface\/controls\/map#pin-clustering\">Maps documentation<\/a>.<\/p>\n<h2>Summary<\/h2>\n<p>Pin clustering brings a polished, production-ready experience to .NET MAUI Maps. Enable it with a single property, customize it with clustering identifiers, and handle taps with a straightforward event. We\u2019re looking forward to seeing what you build with it.<\/p>\n<p>Get started by installing <a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/11.0\">.NET 11 Preview 2<\/a> and updating or installing the .NET MAUI workload.<\/p>\n<p>If you\u2019re on Windows using Visual Studio, we recommend installing the latest <a href=\"https:\/\/visualstudio.microsoft.com\/insiders\">Visual Studio 2026 Insiders<\/a>. You can also use Visual Studio Code and the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-dotnettools.csdevkit\">C# Dev Kit<\/a> extension with .NET 11.<\/p>\n<p>The post <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/pin-clustering-in-dotnet-maui-maps\/\">Pin Clustering in .NET MAUI Maps<\/a> appeared first on <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\">.NET Blog<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve ever loaded a map with dozens \u2014 or hundreds \u2014 of pins, you know the result: an overlapping [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":94,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[],"class_list":["post-3656","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet"],"_links":{"self":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/3656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/comments?post=3656"}],"version-history":[{"count":0,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/3656\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media\/94"}],"wp:attachment":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media?parent=3656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/categories?post=3656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/tags?post=3656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}