Statistics

This sample demonstrates using the ArcGIS Runtime SDK for WPF to perform a query and generate Statistics for fields. The query is run when the sample loads.

In the sample's code-behind, a list of OutStatistic instances is created. Each OutStatistic uses OnStatisticField to specify the field to generate a statistic for, OutStatisticFieldName to specify the field to contain the statistic in the output, and StatisticType to specify the type of statistic to generate. This sample shows both StatisticType.Sum and StatisticType.Count. The query is then executed to generate the requested Statistics, and the results are used to populate the DataGrid.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LocalStatistics"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="DataGridScrollViewer" HorizontalScrollBarVisibility="Hidden">
            <DataGrid x:Name="OutStatisticsDataGrid" AutoGenerateColumns="False" HeadersVisibility="Column" 
                              Background="White">
                <DataGrid.Columns>
                    <DataGridTextColumn Width="110" Binding="{Binding Attributes[SUB_REGION] }" Header="US Region" />
                    <DataGridTextColumn Width="110" Binding="{Binding Attributes[NumberOfStates] }" Header="State Count" />
                    <DataGridTextColumn Width="110" Binding="{Binding Attributes[SubRegionPopulation] }" Header="Population 2010" />
                </DataGrid.Columns>
            </DataGrid>
        </ScrollViewer>
    </Grid>
</UserControl>



Sample code usage restrictions
5/16/2014