S57 Identify

This sample shows how to perform a point-based identify style operation on an HydrographicS57Layer using the HitTestAsync method. Note that HitTest operations take screen coordinates as opposed other query/search operations which typically take a spatial geometry object.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.S57Identify"
             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"
             xmlns:local="clr-namespace:ArcGISWPFSDK">
    <Grid>
        <Grid.Resources>
            <Style TargetType="ListBoxItem">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBoxItem">
                            <Border x:Name="ItemBorder"
                                    BorderBrush="Black"
                                    Background="LightGray"
                                    BorderThickness="2"         
                                    Margin="3">
                                <ContentPresenter Margin="2" />
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="ItemBorder"
                                            Property="BorderBrush"
                                            Value="Blue" />
                                </Trigger>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter TargetName="ItemBorder"
                                            Property="BorderBrush"
                                            Value="Red"/>
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsMouseOver" Value="False" />
                                        <Condition Property="IsSelected" Value="False" />
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="ItemBorder"
                                            Property="Opacity"
                                            Value="0.50" />
                                </MultiTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
           
        </Grid.Resources>
        <Grid>

            <esri:Map x:Name="MyMap"  UseAcceleratedDisplay="True" Extent="-15090086, 4141039, -13113925 , 5862778"
                     WrapAround="True" MinimumResolution="5">

                <esri:ArcGISTiledMapServiceLayer ID="Ocean_BaseMap"
                        Url="http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer" />

                <esri:HydrographicS57Layer x:Name="S57Layer"  ID="S57" Initialized="S57Layer_Initialized">
                    <esri:S57Cell Path="..\Data\s57_electronic_navigational_charts\US1WC01M\US1WC01M.000" />
                    <esri:S57Cell Path="..\Data\s57_electronic_navigational_charts\US1WC07M\US1WC07M.000" />
                </esri:HydrographicS57Layer>

                <esri:GraphicsLayer x:Name="_identifyResults" ID="Identify Results" Opacity="0.5"  />

            </esri:Map>

            <Grid Width="300" Height="550" Margin="5,5,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                <Grid.Resources>
                    <DataTemplate x:Key="identifyResults">
                        <StackPanel Orientation="Vertical" Margin="5,5">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Acronym: " />
                                <TextBlock Text="{Binding Path=Acronym}" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Long Name: " />
                                <TextBlock Text="{Binding Path=LongName}"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Cell Name: " />
                                <TextBlock Text="{Binding Path=CellName}"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Composition Scale: " />
                                <TextBlock Text="{Binding Path=CompositionScale}"/>
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </Grid.Resources>

                <Rectangle Height="550" Grid.RowSpan="6" VerticalAlignment="Top" Fill="White" Stroke="Gray" >
                    <Rectangle.Effect>
                        <DropShadowEffect/>
                    </Rectangle.Effect>
                </Rectangle>
                <Rectangle Grid.RowSpan="6" Margin="5" Fill="#DDFFFFFF" Stroke="DarkGray" />

                <StackPanel>
                    <TextBlock Margin="10,10,5,0">Click on the map to perform an Identify operation.</TextBlock>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Margin="10,5,5,0">Found:</TextBlock>
                        <TextBlock Margin="5,5,5,0" x:Name="IdentifyResultsText"/>
                    </StackPanel>
                    <ListBox x:Name="ResultItems" ItemTemplate="{StaticResource identifyResults}" 
                             SelectionChanged="ResultItems_SelectionChanged" Width="280" Height="350"
                             HorizontalContentAlignment="Stretch" Margin="10,5,10,10" />
                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"  
                         Width="280" Height="125">
                        <DataGrid x:Name="ResultAttributes"  AutoGenerateColumns="True" HeadersVisibility="All" 
                              Background="White">
                        </DataGrid>
                    </ScrollViewer>

                </StackPanel>
            </Grid>

        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014