On Demand FeatureLayer
This sample demonstrates selecting individual features in a local feature layer using OnDemand mode. Only the features in the current map extent are retrieved. As the map extent changes, additional features are requested. The features are renderered using a SimpleRenderer with a SimpleFillSymbol defined MapTips.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.LocalFeatureLayerOnDemand" 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="MySimplePolygonRenderer"> <esri:SimpleRenderer.Symbol> <esri:SimpleFillSymbol Fill="#440000FF"/> </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" MinimumResolution="2445.98490512499"> <esri:ArcGISLocalTiledLayer ID="TopoMapLayer" Path="..\\Data\\TPKs\\Topographic.tpk"/> <esri:ArcGISLocalFeatureLayer ID="States" LayerName="States" Path="..\\Data\\MPKS\\USCitiesStates.mpk" Mode="OnDemand" Renderer="{StaticResource MySimplePolygonRenderer}" OnDemandCacheSize="500" OutFields="*"> <esri:ArcGISLocalFeatureLayer.MapTip> <Border CornerRadius="10" BorderBrush="Black" BorderThickness="2" Margin="0,0,15,15" Background="{StaticResource PanelGradient}" > <StackPanel Margin="7"> <StackPanel Orientation="Vertical"> <TextBlock Text="State: " FontWeight="Bold" Foreground="White"/> <TextBlock Text="{Binding [STATE_NAME]}" Foreground="White" /> <TextBlock Text="Population: " FontWeight="Bold" Foreground="White"/> <TextBlock Text="{Binding [POP2010]}" Foreground="White" /> </StackPanel> </StackPanel> </Border> </esri:ArcGISLocalFeatureLayer.MapTip> </esri:ArcGISLocalFeatureLayer> </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> <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