Select to view content in your preferred language

CompositeSymbol in ArcGIS API for Silverlight

659
1
01-28-2014 07:51 AM
AliKaraman1
New Contributor
Hi All,

There is no "CompositeSymbol" class in "ArcGIS API for Silverlight"
as there are in other APIs (Esri's Flex, Java etc.)

Is there a work around?

I want to combine two symbols, namely "PictureMarkerSymbol" and "TextSymbol" as one Symbol object, to use it in a single renderer and layer.
It must be bindined to a graphic object which has only a point geometry.

Thanks!
0 Kudos
1 Reply
LanceCrumbliss
Occasional Contributor II
You can pretty much make a symbol look like anything using the controltemplate, including a "composite symbol":

<symbols:MarkerSymbol x:Key="AtSymbol" OffsetX="10" OffsetY="10">
                <symbols:MarkerSymbol.ControlTemplate>
                    <ControlTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="Highlight" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.15"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Normal"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="SelectionStates">
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="Highlight" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.5" AutoReverse="True" RepeatBehavior="Forever"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unselected" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Image HorizontalAlignment="Left"  Source="Images/At_Location.png" Opacity="1" Width="20" Height="20"/>
                            <Image x:Name="Highlight" HorizontalAlignment="Left"  Source="Images/At_Location_hover.png" Opacity="0" IsHitTestVisible="False" Width="20" Height="20"/>
                            <Grid IsHitTestVisible="False" Grid.Row="1" Margin="20,-2,0,0">
                                <TextBlock Margin="2,2"  Text="{Binding Attributes[Name]}" Foreground="Black" FontWeight="Bold" FontSize="12"/>
                                <TextBlock Text="{Binding Attributes[Name]}" Foreground="White" FontWeight="Bold" FontSize="12"/>
                                <Grid.Effect>
                                    <DropShadowEffect />
                                </Grid.Effect>
                            </Grid>


                        </Grid>
                    </ControlTemplate>
                </symbols:MarkerSymbol.ControlTemplate>
            </symbols:MarkerSymbol>
            <esri:SimpleRenderer x:Name="AtSymbol_Renderer" Symbol="{StaticResource AtSymbol}"/>
0 Kudos