Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Aggregate Vector Items Using a Clusterer

  • 2 minutes to read

To aggregate vector items using the clusterer, assign a MapClustererBase class descendant to the MapDataAdapterBase.Clusterer property. Then optionally, specify the clusterer’s properties.

For example, all predefined clusterers allow you to group items before clustering and customize the appearance of cluster representatives.

To group items, assign AttributeGroupProvider to the MapClusterer.GroupProvider property. Then, set the provider’s AttributeGroupProvider.AttributeName property to location.

To customize the appearance of cluster representatives, assign the required MapItemSettings class descendant object to the MapClusterer.ClusterSettings property.

using System.Windows;
using DevExpress.Xpf.Map;

namespace ClustererSample {
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
        }

        private void MarkerClusterer_Clustered(object sender, ClusteredEventArgs e) {
            map.ZoomToFitLayerItems();
        }
    }
}