Rendering FeatureLayer
This sample demonstrates different rendering options for local feature layers. The cities layer uses cluster symbology with custom background and foreground colors specified. The states layer uses a class breaks renderer that renders symbology based on a population density field. The highways layer uses a SimpleRenderer to specify a custom line symbol that animates when moused over.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.LocalFeatureLayerRendering" 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" Background="White"> <Grid.Resources> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> <esri:SimpleMarkerSymbol x:Key="MyGreenMarkerSymbol" Color="#CC00FF00" Size="10" /> <esri:SimpleMarkerSymbol x:Key="MyRedMarkerSymbol" Color="#CCFF0000" Size="10" /> <esri:UniqueValueRenderer x:Key="MyUniqueValueRendererPoints" Field="ST" > <esri:UniqueValueRenderer.Infos> <esri:UniqueValueInfo Value="TX" Symbol="{StaticResource MyGreenMarkerSymbol}" /> <esri:UniqueValueInfo Value="CA" Symbol="{StaticResource MyRedMarkerSymbol}" /> </esri:UniqueValueRenderer.Infos> </esri:UniqueValueRenderer> <esri:SimpleRenderer x:Key="MySimpleRendererLines" > <esri:SimpleRenderer.Symbol> <esri:LineSymbol > <esri:LineSymbol.ControlTemplate> <ControlTemplate> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimation BeginTime="0" Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.StrokeThickness)" To="3" Duration="00:00:01" /> </Storyboard> </VisualState> <VisualState x:Name="Normal"> <Storyboard> <DoubleAnimation BeginTime="0" Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.StrokeThickness)" To="1" Duration="00:00:01" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Path x:Name="Element" Stroke="Blue" StrokeThickness="1" /> </Grid> </ControlTemplate> </esri:LineSymbol.ControlTemplate> </esri:LineSymbol> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> <esri:SimpleFillSymbol x:Key="LowFillSymbol" Fill="#99B9D3EE" BorderBrush="#AAFFFFFF" BorderThickness="1" /> <esri:SimpleFillSymbol x:Key="MediumFillSymbol" Fill="#999FB6CD" BorderBrush="#AAFFFFFF" BorderThickness="1" /> <esri:SimpleFillSymbol x:Key="HighFillSymbol" Fill="#996C7B8B" BorderBrush="#AAFFFFFF" BorderThickness="1"/> <esri:ClassBreaksRenderer x:Key="MyClassBreaksRenderer" Field="POP10_SQMI" > <esri:ClassBreaksRenderer.Classes> <esri:ClassBreakInfo MinimumValue="0" MaximumValue="50" Symbol="{StaticResource LowFillSymbol}" /> <esri:ClassBreakInfo MinimumValue="50" MaximumValue="200" Symbol="{StaticResource MediumFillSymbol}" /> <esri:ClassBreakInfo MinimumValue="200" MaximumValue="50000" Symbol="{StaticResource HighFillSymbol}" /> </esri:ClassBreaksRenderer.Classes> </esri:ClassBreaksRenderer> </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 MyClassBreaksRenderer}" OutFields="POP10_SQMI"/> <esri:ArcGISLocalFeatureLayer ID="Highways" Path="..\\Data\\MPKS\\USCitiesStates.mpk" LayerName="Highways" Renderer="{StaticResource MySimpleRendererLines}" /> <esri:ArcGISLocalFeatureLayer ID="Cities" LayerName="Cities" Path="..\\Data\\MPKS\\USCitiesStates.mpk" Renderer="{StaticResource MyUniqueValueRendererPoints}" Where="POP2007 > 75000" OutFields="ST"> <esri:ArcGISLocalFeatureLayer.Clusterer> <esri:FlareClusterer FlareBackground="Orange" FlareForeground="Black" MaximumFlareCount="9" /> </esri:ArcGISLocalFeatureLayer.Clusterer> </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