Filtering a FeatureLayer

This sample demonstrates applying filters to a local feature layer. Filters allow you to retrieve a subset of records that match an attribute or spatial query. The sample includes two local feaure layers, one with an attribute filter and the other with a spatial filter. As the sample shows, an attribute filter is specified by defining a query in the local layer's Where property. A spatial filter is specified by defining the local layer's Geometry property.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.LocalFeatureLayerFiltering" 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"> <Grid x:Name="LayoutRoot"> <Grid.Resources> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> <esri:SimpleRenderer x:Key="MySimplePointRenderer"> <esri:SimpleRenderer.Symbol> <esri:SimpleMarkerSymbol Color="Orange"/> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> <esri:SimpleRenderer x:Key="MySimplePolygonRenderer"> <esri:SimpleRenderer.Symbol> <esri:SimpleFillSymbol Fill="#440000FF"/> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> </Grid.Resources> <esri:Map x:Name="MyMap" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" MinimumResolution="2445.98490512499"> <esri:Map.Layers> <esri:ArcGISLocalTiledLayer ID="TopoMapLayer" Path="..\\Data\\TPKs\\Topographic.tpk"/> <esri:ArcGISLocalFeatureLayer ID="States" LayerName="States" Path="..\\Data\\MPKS\\USCitiesStates.mpk" Renderer="{StaticResource MySimplePolygonRenderer}"> <esri:ArcGISLocalFeatureLayer.Geometry> <esri:Envelope XMin="-12330709" YMin="-13610919" XMax="8242944" YMax="8326892" > </esri:Envelope> </esri:ArcGISLocalFeatureLayer.Geometry> </esri:ArcGISLocalFeatureLayer> <esri:ArcGISLocalFeatureLayer ID="Cities" LayerName="Cities" Path="..\\Data\\MPKS\\USCitiesStates.mpk" Where="POP2007 > 1000000" Renderer="{StaticResource MySimplePointRenderer}"> </esri:ArcGISLocalFeatureLayer> </esri:Map.Layers> </esri:Map> <ProgressBar x:Name="MyProgressBar" IsIndeterminate="True" VerticalAlignment="Bottom" Width="200" Height="20" Margin="10" Visibility="{Binding Path=IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"></ProgressBar> </Grid> </UserControl>
5/16/2014