Tag: symbol display

Fast display of beautiful symbology in ArcGIS Online

Crash Rate Trends

ArcGIS Pro allows you to create beautiful maps with complex and interesting symbology! Here are some tips for maximizing the display performance of your maps and data in ArcGIS Online.

Posted in Analysis & Geoprocessing, ArcGIS Online, ArcGIS Pro, Spatial Statistics, Story Maps, Web | Tagged , , , , , , | 7 Comments

Use SymbolDisplay to create symbol swatches for legends

The current version of the ArcGIS Silverlight/WPF API contains a set of primitive controls used to build other public controls in the Toolkit library (ESRI.ArcGIS.Client.Toolkit.dll).   For example, the Editor Widget and Template Picker controls display a swatch for each symbol in an editable graphics or feature layer.  The primitive control that provides this functionality is SymbolDisplay.  SymbolDisplay takes a Symbol and generates a swatch at the defined height and width.  It’s convenient for generating a scaled visual representation of graphic symbols for display in a legend or printable output.  The following code example shows how to generate a legend using symbols defined as part of a feature layer in a map service. You can also create and use SymbolDisplay at runtime in code-behind.

<!-- Namespaces -->
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
xmlns:esriToolkitPrimitives="clr-namespace:ESRI.ArcGIS.Client.Toolkit.Primitives;assembly=ESRI.ArcGIS.Client.Toolkit">


<!-- FeatureLayer in a map -->
<esri:FeatureLayer ID="MyFeatureLayer1" Visible="True"
Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/MapServer/0" />

<!-- SymbolDisplay in a ListBox -->
<ListBox Margin="0,5,0,0" IsHitTestVisible="False" BorderThickness="0"
ItemsSource="{Binding ElementName=MyMap, Path=Layers.[MyFeatureLayer1].LayerInfo.Renderer.Infos}"
Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<esriToolkitPrimitives:SymbolDisplay
Symbol="{Binding Symbol}"
Width="20" Height="20"
VerticalAlignment="Center" />
<TextBlock Text="{Binding Label}"
FontSize="10"
VerticalAlignment="Center"
Margin="5,0,0,0" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

Here is a screenshot of SymbolDisplay in action:

Keep in mind that the source code for the Toolkit library is available on Codeplex; this includes the SymbolDisplay class.  The source code is available for download under the Downloads or Source Code tab.  

View the live demo

Download the source code

Enjoy!

Rex Hansen
ESRI Product Engineer
ArcGIS Server .NET, Silverlight/WPF, MapIt

Posted in Web | Tagged , | 4 Comments