Find features in a feature table which match an SQL query.
      
  
    
Use case
Query expressions can be used in ArcGIS to select a subset of features from a feature table. This is most useful in large or complicated data sets. A possible use case might be on a feature table marking the location of street furniture through a city. A user may wish to query by a TYPE column to return "benches". In this sample, we query a U.S. state by STATE_NAME from a feature table containing all U.S. states.
How to use the sample
Input the name of a U.S. state into the text field. When you click the button, a query is performed and the matching features are highlighted or an error is returned.
How it works
- Create a 
ServiceFeatureTableusing the URL of a feature service. - Create a 
QueryParameterswith a where clause specified using theWhereClauseproperty. - Perform the query using 
QueryFeaturesAsync(query)on the service feature table. - When complete, the query will return a 
FeatureQueryResultwhich can be iterated over to get the matching features. 
Relevant API
- FeatureLayer
 - FeatureQueryResult
 - QueryParameters
 - ServiceFeatureTable
 
About the data
This sample uses U.S. State polygon features from the USA 2016 Daytime Population feature service.
Tags
query, search
Sample Code
<UserControl x:Class="ArcGISRuntime.WinUI.Samples.FeatureLayerQuery.FeatureLayerQuery"
             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 Style="{StaticResource BorderStyle}">
            <StackPanel>
                <TextBlock Margin="0,0,0,5"
                           FontWeight="SemiBold"
                           IsColorFontEnabled="False"
                           Text="Enter a state name and press 🔎 to search."
                           TextAlignment="Center" />
                <AutoSuggestBox HorizontalAlignment="Stretch"
                                QueryIcon="Find"
                                QuerySubmitted="QueryEntry_QuerySubmitted"
                                Text="New York" />
            </StackPanel>
        </Border>
    </Grid>
</UserControl>