Custom Clusterer

This sample demonstrates implementing a custom clusterer. The clusterer in this sample aggregates the values of a specified field for each feautre in a cluster and displays that value on the cluster. In the sample XAML, the custom clusterer is used to display aggregate population for each cluster.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LocalCustomClusterer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
    xmlns:samples="clr-namespace:ArcGISWPFSDK">
    <Grid x:Name="LayoutRoot" Background="White" >
        <Grid.Resources>
            <esri:SimpleRenderer x:Key="MySimpleRenderer">
                <esri:SimpleRenderer.Symbol>
                    <esri:SimpleMarkerSymbol Color="#FF00BB00"/>
                </esri:SimpleRenderer.Symbol>
            </esri:SimpleRenderer>
            <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="#FF145787" Offset="0.16"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.502"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>
        </Grid.Resources>
        <esri:Map x:Name="MyMap" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" MinimumResolution="2445.98490512499">
            <esri:ArcGISLocalTiledLayer ID="myBaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/>
            <esri:ArcGISLocalFeatureLayer ID="MyFeatureLayer" LayerName="Cities" 
                   Path="..\\Data\\MPKS\\USCitiesStates.mpk"      
                    Where="POP2000 > 75000"
                    OutFields="POP2000"  Renderer="{StaticResource MySimpleRenderer}">
                <esri:ArcGISLocalFeatureLayer.Clusterer>
                    <samples:SumClusterer AggregateColumn="POP2000" SymbolScale="0.001" />
                </esri:ArcGISLocalFeatureLayer.Clusterer>
                <esri:ArcGISLocalFeatureLayer.MapTip>
                    <Grid Background="LightYellow">
                        <StackPanel Margin="5">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Foreground="Black" Text="Population (2000): " />
                                <TextBlock Foreground="Black" Text="{Binding Path=.[POP2000]}" />
                            </StackPanel>
                        </StackPanel>
                        <Border BorderBrush="Black" BorderThickness="1" />
                    </Grid>
                </esri:ArcGISLocalFeatureLayer.MapTip>
            </esri:ArcGISLocalFeatureLayer>
        </esri:Map>
        <Grid Margin="10" HorizontalAlignment="Right" VerticalAlignment="Top">
            <Border Background="{StaticResource PanelGradient}" CornerRadius="3" Padding="5">
                <StackPanel Orientation="Vertical" Margin="5">
                    <TextBlock Text="Population density" Foreground="White" FontWeight="Bold" FontSize="12" Margin="3" />
                    <CheckBox Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" IsChecked="True"  
                        HorizontalAlignment="Center" Foreground="Black" Margin="0,0,5,0" >
                        <TextBlock Foreground="White" Text="Enable Clustering"></TextBlock>
                    </CheckBox>
                </StackPanel>
            </Border>
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014