ArcGIS API for Silverlight - Library Reference
Symbol Class
Members  See Also  Send comments on this topic
ESRI.ArcGIS.Client.Symbols Namespace : Symbol Class

Abstract Symbol class used by all Symbols

Object Model

Symbol Class


Visual Basic (Declaration) 
Public MustInherit Class Symbol 
   Inherits System.Windows.DependencyObject
public abstract class Symbol : System.Windows.DependencyObject 


The Symbol object is used to defined how to render a ESRI.ArcGIS.Client.Graphic in a GraphicsLayer. The symbol mainly consists of a ControlTemplate and optionally a set of properties that can be bound into the template. A ESRI.ArcGIS.Client.Graphic's ESRI.ArcGIS.Client.Graphic.Geometry type must match the symbol type. Ie. a MarkerSymbol for a MapPoint or MultiPoint, FillSymbol for a Polygon and LineSymbol for a Polyline.

Custom templates: Generally when you use custom templates you should be using the base MarkerSymbol, FillSymbol and LineSymbol types, and refrain from using the Simple* sub types such as SimpleMarkerSymbol, SimpleLineSymbol, and SimpleFillSymbol.

FillSymbol and LineSymbol are required to have a System.Windows.Shapes.Path element with the name "Element" at the root of the template. MarkerSymbol templates however can be any type of System.Windows.UIElement, however to achieve the best performance when rendering many Graphics, it is best to have as few System.Windows.UIElements in the template as possible, and try to share resources across multiple Graphics that uses the same symbol (ie. share the same Brush in a static resource rather than create one inside the template).

Example: Custom MarkerSymbol template: The below example creates a square marker symbol with rounded corners 20x20 pixels. We use the OffsetX and OffsetY properties to center the symbol on top of the Graphic.

            <esriSymbols:MarkerSymbol OffsetX="10" OffsetY="10">
                  <Border Width="20" Height="20" CornerRadius="3" 
                          BorderBrush="Black" BorderThickness="1" 
                    <Image Source="myImage.png" />

Animating symbols using Visual States: The control template has two System.Windows.VisualStateGroups that can be used in the custom template. These System.Windows.Media.Animation.Storyboard animations are automatically triggered when the user mouses over the graphic or changes the ESRI.ArcGIS.Client.Graphic.Selected property. Note: The XAML System.Windows.VisualStateManager Class was newly added in the .NET Framework v4.0. If you are running the .NET Framework v3.5 then you can download and Reference the WPFToolkit on Codeplex to take advantage of the VisualStateManager Class.

Visual State Group Visual States
CommonStates Normal, MouseOver
SelectionStates Unselected, Selected

Example: MarkerSymbol that becomes bigger when the user mouse-overs it:

              <Ellipse x:Name="ellipse"
                     Fill="{Binding Symbol.Color}"
                     Width="{Binding Symbol.Size}"
                     Height="{Binding Symbol.Size}" >
                  <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal">
                        <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" To="1" Duration="0:0:0.1" />
                        <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" To="1" Duration="0:0:0.1" />
                    <VisualState x:Name="MouseOver">
                        <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" To="1.25" Duration="0:0:0.1" />
                        <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" To="1.25" Duration="0:0:0.1" />
                  <ScaleTransform ScaleX="1" ScaleY="1" />
Example: FillSymbol that changes it's fill color when it becomes selected:
              <Path x:Name="Element"
                  <VisualStateGroup x:Name="SelectionStates">
                    <VisualState x:Name="Unselected" />
                    <VisualState x:Name="Selected">
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Element"
                          <DiscreteObjectKeyFrame KeyTime="0:0:0">
                              <SolidColorBrush Color="Cyan" />

Inheritance Hierarchy



Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© ESRI, Inc. All Rights Reserved.