On Demand FeatureLayer Online
This sample demonstrates selecting individual features in an ESRI.ArcGIS.Client FeatureLayer using OnDemand mode. Features that are in the current map extent are automatically selected as pan/zooms occur
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.FeatureLayerOnDemand" 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> <esri:SimpleRenderer x:Key="DefaultFillRenderer"> <esri:SimpleRenderer.Symbol> <esri:SimpleFillSymbol BorderBrush="Blue" Fill="#330000FF" /> </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" WrapAround="True" Background="#FFE3E3E3"> <esri:ArcGISTiledMapServiceLayer ID="BaseLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" /> <esri:FeatureLayer ID="CensusDemographics" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/1" Mode="OnDemand" Renderer="{StaticResource DefaultFillRenderer}" OnDemandCacheSize="500" OutFields="FIPS,POP2007"> <esri:FeatureLayer.MapTip> <Border CornerRadius="10" BorderBrush="Black" BorderThickness="2" Margin="0,0,15,15" Background="{StaticResource PanelGradient}" > <StackPanel Margin="7"> <TextBlock Text="FIPS: " FontWeight="Bold" Foreground="White" /> <TextBlock Text="{Binding [FIPS]}" Foreground="White" /> <StackPanel Orientation="Horizontal"> <TextBlock Text="Population: " FontWeight="Bold" Foreground="White" /> <TextBlock Text="{Binding [POP2007]}" Foreground="White" /> </StackPanel> </StackPanel> </Border> </esri:FeatureLayer.MapTip> </esri:FeatureLayer> </esri:Map> <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,10,10,0" > <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray" RadiusX="10" RadiusY="10" Margin="0,0,0,5"> <Rectangle.Effect> <DropShadowEffect/> </Rectangle.Effect> </Rectangle> <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" /> <TextBlock x:Name="ResponseTextBlock" Text="The feature layer is in OnDemand mode. Only features within the current map extent are retrieved. As the map extent changes, additional features are requested." Width="200" TextAlignment="Left" Margin="30,20,20,30" TextWrapping="Wrap" Foreground="Black" /> </Grid> </Grid> </UserControl>
5/16/2014