Symbol Dictionary Search

This sample illustrates how to search the Mil2525C symbol dictionary. The military symbols which are displayed using the MessageProcessor class are stored in a symbol dictionary and accessed vie the SymbolDictionary class. The symbols in the dictionary have metadata stored with them which can be used to perform searches to find the correct symbol. Each military symbol in the SymbolDictionary can be searched using Keywords and/or Filters. Every symbol has a number of keywords associated with it. These could be keywords such as "Trainer", "Volcanic Eruption", "Vip" etc. All possible keywords used in the symbol dictionary can be obtained from the SymbolDictionary. Each symbol also has 3 attributes ("StyleFile", "Category" and "Geometry Type"). These attributes will have a value assigned to them. All possible attribute value combinations (known as filters) can be obtained using the SymbolDictionary. The chosen symbol identifier (SIC) can then be used to construct a new message using the MessageHelper class to aid the construction of a Message which in turn can be processed by the MessageProcessor to display the symbol on the map. Typically the results from the Keywords and Filters methods will be used to populate user interface components which allow an application user to search for symbols to place the appropriate symbol on the map, for example when making a spot report.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.SymbolDictionarySearch"
    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>
            <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="#FF145787" Offset="0.16"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.502"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>
        </Grid.Resources>

        <esri:Map x:Name="_map" UseAcceleratedDisplay="True" MouseClick="_map_MouseClick">
            <esri:ArcGISTiledMapServiceLayer ID="MyLayer" 
                Url="http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer" />
            <esri:MessageGroupLayer x:Name="_messageGroupLayer" SymbolDictionaryType="Mil2525C" />
        </esri:Map>
        <Border Background="{ StaticResource PanelGradient}" BorderThickness="1" CornerRadius="5"
                HorizontalAlignment="Left"  VerticalAlignment="Top"
                Margin="5" Padding="10" BorderBrush="Gray">
        <StackPanel>
                <TextBlock FontWeight="Bold" Foreground="White">
                    Search the symbol dictionary by <LineBreak/>
                    choosing a combination of one or <LineBreak/>       
                    more keywords or filters.<LineBreak/>
                    To view symbols on the map select <LineBreak/>
                    a symbol from the results list then <LineBreak/>
                    click on the map.<LineBreak/>
                </TextBlock>
            </StackPanel>
        </Border>
        <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5,5,5,5" >
            <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray" RadiusX="10" RadiusY="10"  Margin="0,0,0,5" >
            </Rectangle>
            <Grid Height="540" Width="400">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="5,25,5,0" 
                           Grid.ColumnSpan="2" Grid.RowSpan="3"/>

                <Rectangle Fill="#FFFFFFFF" Grid.Row="4" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="5,0,5,0" 
                           Grid.ColumnSpan="2" Grid.RowSpan="3"/>

                <Rectangle Fill="#FFFFFFFF" Grid.Row="8" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="5,0,5,10" 
                           Grid.ColumnSpan="2" Grid.RowSpan="3"/>

                <TextBlock Margin="5,5,10,5" Grid.ColumnSpan="2" FontWeight="Bold" HorizontalAlignment="Left" 
                           Foreground="White">Keywords:</TextBlock>

                <TextBlock Margin="10,5,10,5" HorizontalAlignment="Left" Grid.Row="1">Keyword(s):</TextBlock>
                <ComboBox Name="cmbKeyword" SelectionChanged="KeywordSelectionChanged" ItemsSource="{Binding Keywords}" 
                          Width="280" Margin="5,5,0,0" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="1" />
                <ListBox Margin="10,5,10,5"  Grid.Row="2" Grid.ColumnSpan="2" Name="lstKeywords" ItemsSource="{Binding SelectedKeywords}"
                         BorderThickness="0">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <DockPanel LastChildFill="True">
                                <Button Height="16" Width="16" DockPanel.Dock="Right" Click="RemoveKeyword">
                                    <Image Source="/Assets/Images/remove.png"/>
                                </Button>
                                <TextBlock MinWidth="355" Margin="0,0,0,5" Text="{Binding}"></TextBlock>
                            </DockPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

                <TextBlock Margin="5,5,5,5" Grid.Row="3" Grid.ColumnSpan="2" FontWeight="Bold" HorizontalAlignment="Left" 
                           Foreground="White">Filters:</TextBlock>

                <TextBlock Margin="10,5,5,5"  HorizontalAlignment="Left" Grid.Row="4">StyleFile:</TextBlock>
                <ComboBox Grid.Row="4" Name="cmbStyleFile" SelectionChanged="SelectionChanged" Grid.Column="1" ItemsSource="{Binding StyleFiles}"
                          Width="280" Margin="5,5,5,5"  HorizontalAlignment="Left"/>

                <TextBlock Margin="10,0,5,5"  HorizontalAlignment="Left" Grid.Row="5">Category:</TextBlock>
                <ComboBox Name="cmbCategory" SelectionChanged="SelectionChanged"  Grid.Row="5" Grid.Column="1" ItemsSource="{Binding Categories}"
                          Width="280" Margin="5,0,5,5" HorizontalAlignment="Left"/>

                <TextBlock Margin="10,0,5,5" HorizontalAlignment="Left" Grid.Row="6">Geometry Type:</TextBlock>
                <ListBox Name="cmbGeometryType" SelectionChanged="SelectionChanged" ItemsSource="{Binding GeometryTypes}"
                          Width="280" Margin="5,0,5,5"  HorizontalAlignment="Left" Grid.Row="6" Grid.Column="1" SelectionMode="Extended" />

                <TextBlock Margin="5,5,10,5" Grid.Row="7" Grid.ColumnSpan="2" FontWeight="Bold" HorizontalAlignment="Left" 
                           Foreground="White">Symbol Results:</TextBlock>

                <TextBlock Margin="10,5,10,5"  HorizontalAlignment="Left" Grid.Row="8" Grid.Column="0">Symbols found:</TextBlock>
                <TextBlock Margin="15,5,10,5"  HorizontalAlignment="Left" Grid.Row="8" Grid.Column="1" Text="{Binding Symbols.Count}"></TextBlock>

                <ListBox x:Name="SymbolListBox" SelectionChanged="SymbolListBox_SelectionChanged" Grid.ColumnSpan="2" Margin="10,0,10,15"  Grid.Row="10" ItemsSource="{Binding Symbols}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <TextBlock HorizontalAlignment="Left" Text="{Binding Name}"/>
                                <TextBlock HorizontalAlignment="Left" FontSize="10" Foreground="Gray" Text="{Binding Keywords}"/>
                                <Grid HorizontalAlignment="Left">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="200"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Image Width="{Binding ImageSize}" Height="{Binding ImageSize}" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" Stretch="Uniform" Source="{Binding Thumbnail}"/>
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="auto"></RowDefinition>
                                            <RowDefinition Height="auto"></RowDefinition>
                                            <RowDefinition Height="auto"></RowDefinition>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Grid.Row="0" Grid.Column="0" Width="100">Category:</TextBlock>
                                        <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Category}"/>
                                        <TextBlock Grid.Row="1" Grid.Column="0">Symbol ID:</TextBlock>
                                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding SymbolID}"/>
                                        <TextBlock Grid.Row="2" Grid.Column="0">Stylefile:</TextBlock>
                                        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding StyleFile}"/>
                                    </Grid>
                                </Grid>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014