<!-- Identity-->
<Canvas HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="0" Grid.Column="2">
<StackPanel Orientation="Vertical" Margin="10" >
<Grid x:Name="IdentifyGrid" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0,7,7,0" >
<Rectangle Fill="#22000000" RadiusX="10" RadiusY="10" Margin="0,4,0,0" />
<Rectangle Fill="#CC5C90B2" Stroke="Gray" RadiusX="10" RadiusY="10" Margin="0,0,0,5" />
<TextBlock x:Name="DataDisplayTitleTop" Text="Click on map to identify a feature" Foreground="Black" FontSize="10"
Margin="10,5,0,0" />
<TextBlock x:Name="DataDisplayTitleBottom" Text="Click on map to identify a feature" Foreground="White" FontSize="10"
Margin="10,3,0,5" />
<StackPanel Orientation="Vertical" Margin="15" HorizontalAlignment="Right" VerticalAlignment="Center">
<ComboBox x:Name="IdentifyComboBox" MinWidth="150" SelectionChanged="cb_SelectionChanged"
Margin="5,10,5,5" >
</ComboBox>
<ScrollViewer x:Name="DataGridScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
Width="230" MaxHeight="340" Visibility="Collapsed">
<slData:DataGrid x:Name="IdentifyDetailsDataGrid" AutoGenerateColumns="False" HeadersVisibility="None"
Background="White" >
<slData:DataGrid.Columns>
<slData:DataGridTextColumn Binding="{Binding Path=Key}" FontWeight="Bold"/>
<slData:DataGridTextColumn Binding="{Binding Path=Value}"/>
</slData:DataGrid.Columns>
</slData:DataGrid>
</ScrollViewer>
</StackPanel>
</Grid>
</StackPanel>
</Canvas>Actually it is pretty simple. All you need to do is add a toolbaritem to toolbar for identify tool.
<esri:ToolbarItem Text="Identify">
<esri:ToolbarItem.Content>
<Image Source="/Assets/images/i_about.png" Stretch="UniformToFill" Margin="5" />
</esri:ToolbarItem.Content>
</esri:ToolbarItem>
Create a bool variable and set it true only when "Identify" is clicked.
bool identifyclick;
private void MyToolbar_ToolbarItemClicked(object sender, ESRI.ArcGIS.Client.Toolkit.SelectedToolbarItemArgs e)
{
case 7: //Identify
identifyclick = true;
break;
}
}
In Map Mouseclick event check value for this boolean variable to true before running identify logic
private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
{
if (identifyclick)
{
//execute identify code
identifyclick = false // at the end reset the bool variable to deactivate the identify tool.
}
}
Basically it will be combination of ToolbarWidget sample and Identify Sample. Most of the code can be copied from Identify sample and pasted as is to toolbarWidget Sample.
Attached is the sample XAML with implementation. Hope that helps
I think the spatialReference for the Wells layers is different than the basemap layer. The Extent that is going as parameter to identifytask is using the basemap's extent which probably does not match with coordinate system of the Wells layer and that is causing the identifyTask to not return any results. You can put a breakpoint in MyMap_MouseClick to see what is the extent passed to Identifytask parameters and also in IdentifyTask_ExecuteCompleted to see if any results are returned.
--Preeti
It works fine for me...Can you send the code?