Custom Clusterer Online

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.CustomClusterer"
    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" WrapAround="True">
            <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>

            <esri:FeatureLayer ID="MyFeatureLayer"
                    Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0" 
                    Where="POP1990 > 75000" 
                   Renderer="{StaticResource MySimpleRenderer}"
                    OutFields="CITY_NAME,POP1990">
                <esri:FeatureLayer.Clusterer>
                    <samples:SumClusterer AggregateColumn="POP1990" SymbolScale="0.001" />
                </esri:FeatureLayer.Clusterer>
                <esri:FeatureLayer.MapTip>
                    <Grid Background="LightYellow">
                        <StackPanel Margin="5">
                            <TextBlock Foreground="Black" Text="{Binding Path=.[CITY_NAME]}" FontWeight="Bold" />
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Foreground="Black" Text="Population (1990): " />
                                <TextBlock Foreground="Black" Text="{Binding Path=.[POP1990]}" />
                            </StackPanel>
                        </StackPanel>
                        <Border BorderBrush="Black" BorderThickness="1" />
                    </Grid>
                </esri:FeatureLayer.MapTip>
            </esri:FeatureLayer>
        </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