Select to view content in your preferred language

Simple Map

736
2
11-04-2011 01:01 PM
JayKappy
Frequent Contributor
I have a Silverlight application that I have been doign database work in...I am trying to add a map to it....
I can get the map to show up
I get scroll with the mouse and zoom in and out

BUT when I click and try and pan nothing happens..
I even mtried the MouseClick event to push a simple message box and nothing shows up...

Any Ideas why I cannot pan?  I thought I should be able to pan right out of the box..Seems like in dont have any interaction with the map with mouse clicks...


I added these references

           xmlns:esriC="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
           xmlns:esriSymbols="clr-namespace:ESRI.ArcGIS.Client.Symbols;assembly=ESRI.ArcGIS.Client"
           xmlns:esriToolkit="clr-namespace:ESRI.ArcGIS.Client.Toolkit;assembly=ESRI.ArcGIS.Client.Toolkit"
           xmlns:esriConverters="clr-namespace:ESRI.ArcGIS.Client.ValueConverters;assembly=ESRI.ArcGIS.Client"
           xmlns:esri="http://schemas.esri.com/arcgis/client/2009"

This is my Map

<esri:Map x:Name="MyMap" MouseClick="ClickMe" WrapAround="True" Visibility="Collapsed" Width="500" Height="500"
      VerticalAlignment="Center" HorizontalAlignment="Center">
     <esri:Map.Extent>
          <esri:Envelope XMin="-14517899" YMin="2501309" XMax="-6646348" YMax="6542076" />
     </esri:Map.Extent>
                           
     <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Visible="True" Opacity="1.0"
          Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
</esri:Map>

VB   

    Private Sub ClickMe(ByVal sender As System.Object, ByVal e As ESRI.ArcGIS.Client.Map.MouseEventArgs)
        MessageBox.Show("HELLO")
    End Sub
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
Are there any other control on top of your map? Replace the map with a button and add a click event, see if that click event fires. If it doesn't, the map is underneath another control, maybe TextBlock or something. Or is your map inside a scrollviewer? Scrollviewer can intercept the mouse events of your map too. Also, your XAML-code show that map is collapsed, when do you change it to visible?
0 Kudos
JayKappy
Frequent Contributor
Jennifer...thank you very much for your thoughts....
Yea it was collapsed for a reason...set to visable in a TOC
I was actually inside a scroll viewer...I moved it outsode and the scroll works fine...

THANK YOU

EDIT: Meant pan works fine now...and clicks on map
0 Kudos