Rendering with XAML
This sample demonstrates the application of unique value and class breaks renderers using XAML.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.LocalRenderersXAML" 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:SimpleRenderer x:Key="MySimpleRenderer"> <esri:SimpleRenderer.Symbol> <esri:SimpleLineSymbol Color="Blue" Style="Solid" Width="2" /> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> <esri:SimpleFillSymbol x:Key="MyYellowFillSymbol" Fill="#44FFFF00" BorderBrush="Transparent" BorderThickness="2" /> <esri:SimpleFillSymbol x:Key="MyRedFillSymbol" Fill="#44FF0000" BorderBrush="Transparent" BorderThickness="2" /> <esri:UniqueValueRenderer x:Key="MyUniqueValueRenderer" Field="STATE_NAME" > <esri:UniqueValueRenderer.Infos> <esri:UniqueValueInfo Value="Arizona" Symbol="{StaticResource MyRedFillSymbol}" /> <esri:UniqueValueInfo Value="New Mexico" Symbol="{StaticResource MyYellowFillSymbol}" /> <esri:UniqueValueInfo Value="Texas" > <esri:UniqueValueInfo.Symbol> <esri:SimpleFillSymbol Fill="#44FF6600" BorderBrush="Transparent" BorderThickness="2" /> </esri:UniqueValueInfo.Symbol> </esri:UniqueValueInfo> </esri:UniqueValueRenderer.Infos> </esri:UniqueValueRenderer> <esri:SimpleMarkerSymbol x:Key="MySmallMarkerSymbol" Color="#FF007700" Size="8" Style="Circle" /> <esri:SimpleMarkerSymbol x:Key="MyMediumMarkerSymbol" Color="#FF00BB00" Size="12" Style="Circle" /> <esri:SimpleMarkerSymbol x:Key="MyLargeMarkerSymbol" Color="#FF00FF00" Size="16" Style="Circle" /> <esri:ClassBreaksRenderer x:Key="MyClassBreaksRenderer" Field="POP2000" > <esri:ClassBreaksRenderer.Classes> <esri:ClassBreakInfo MinimumValue="0" MaximumValue="30000" Symbol="{StaticResource MySmallMarkerSymbol}" /> <esri:ClassBreakInfo MinimumValue="30000" MaximumValue="300000" Symbol="{StaticResource MyMediumMarkerSymbol}" /> <esri:ClassBreakInfo MinimumValue="300000" MaximumValue="5000000" Symbol="{StaticResource MyLargeMarkerSymbol}" /> </esri:ClassBreaksRenderer.Classes> </esri:ClassBreaksRenderer> </Grid.Resources> <esri:Map x:Name="MyMap" Extent="-15000000,2000000,-7000000,8000000" WrapAround="True" Background="#FFE3E3E3" MinimumResolution="2445.98490512499"> <esri:Map.Layers> <esri:ArcGISLocalTiledLayer ID="myBaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/> <esri:ArcGISLocalFeatureLayer ID="MyFeatureLayerUnique" LayerName="States" Path="..\\Data\\MPKS\\USCitiesStates.mpk" Renderer="{StaticResource MyUniqueValueRenderer}" Where="STATE_NAME in ('New Mexico', 'Arizona', 'Texas')"/> <esri:ArcGISLocalFeatureLayer ID="MyFeatureLayerSimple" LayerName="Highways" Path="..\\Data\\MPKS\\USCitiesStates.mpk" Mode="OnDemand" Renderer="{StaticResource MySimpleRenderer}"/> <esri:ArcGISLocalFeatureLayer ID="MyFeatureLayerClassBreak" LayerName="Cities" Path="..\\Data\\MPKS\\USCitiesStates.mpk" Renderer="{StaticResource MyClassBreaksRenderer}" OutFields="POP2000"/> </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