Query feature count and extent

This sample demonstrates how to query a feature table, in this case returning a count, for features that are within the visible extent or that meet specified criteria.

Query feature count or get the extent of matching features

Instructions

Use the button to zoom to the extent of the state specified (by abbreviation) in the textbox or use the button to count the features in the current extent.

Code

<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.QueryFeatureCountAndExtent.QueryFeatureCountAndExtent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border BorderBrush="Black" BorderThickness="1" Background="White"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="30" Padding="20" Width="375">
            <Grid>
                <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock Text="Tap 'Zoom to matching features' to zoom to features matching the given state abbreviation. Click 'Count features in extent' to count the features in the current extent (regardless of the results of the query)."
                           Grid.Row="0"
                           FontWeight="SemiBold" TextWrapping="Wrap" />
                <TextBox x:Name="StateEntry"
                         Grid.Row="1"
                         Margin="0,5,0,5"
                         PlaceholderText="e.g. NY" />
                <Button Content="Zoom to matching features"
                        Grid.Row="2"
                        HorizontalAlignment="Stretch"
                        Click="BtnZoomToFeaturesClick" />
                <Button Content="Count features in extent"
                        Grid.Row="3"
                        Margin="0,5,0,5"
                        HorizontalAlignment="Stretch"
                        Click="BtnCountFeaturesClick" />
                <TextBlock x:Name="ResultView"
                           Grid.Row="4"
                           Visibility="Collapsed"
                           FontWeight="SemiBold" TextAlignment="Center" />
            </Grid>
        </Border>
    </Grid>
</UserControl>


In this topic
  1. Instructions
  2. Code