Select to view content in your preferred language

Identify..?

1778
10
07-27-2010 01:18 PM
JoshV
by
Regular Contributor
Hello All-

In the samples on the Resource Center I was able to add the Identify sample to my Silverlight (3.0) App and get it to work.  I now want to add that as a Tool to my Toolbar.  Below is the main section of code in the XAML so does anyone know how I can add it as a ToolbarItem?

Many thanks,

<!-- 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>
0 Kudos
10 Replies
JoshV
by
Regular Contributor
You haven't added the handler for MouseClick for map in your XAML. 

<esri:Map x:Name="MyMap" MouseMove="MyMap_MouseMove" Extent="-120, 30, -60, 60"   MouseClick="MyMap_MouseClick"

<esri:Map.Layers> 
<esri:ArcGISTiledMapServiceLayer ID="AGOLayer"  
Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer"/> 
<esri:ArcGISDynamicMapServiceLayer ID="DynamicLayerCalifornia"  
Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer" 
InitializationFailed="Layer_InitializationFailed" /> 
<esri:GraphicsLayer ID="MyGraphicsLayer" /> 

</esri:Map.Layers> 
</esri:Map> 

</esri:Map.Layers> 
</esri:Map>


Works great Preeti- Sorry I had forgot the most important thing, the Mouse click event 🙂 haha. Thanks again.
0 Kudos