You are here: > ESRI Forums > arcgis server forums > Thread Replies

ArcGIS Server Forums

ArcGIS API for Silverlight forum

Disable Silverlight Map Navigation   William Kimrey Jan 13, 2010
Re: Disable Silverlight Map Navigation   Morten Nielsen Jan 13, 2010
Re: Disable Silverlight Map Navigation   William Kimrey Jan 13, 2010
Re: Disable Silverlight Map Navigation   Morten Nielsen Jan 13, 2010
Re: Disable Silverlight Map Navigation   William Kimrey Feb 10, 2010
Re: Disable Silverlight Map Navigation   Morten Nielsen Feb 10, 2010
Re: Disable Silverlight Map Navigation   William Kimrey Feb 11, 2010
Re: Disable Silverlight Map Navigation   Morten Nielsen Feb 12, 2010
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Disable Silverlight Map Navigation 
Author William Kimrey 
Date Jan 13, 2010 
Message Hello all,

I was just wondering if it's possible to disable the mouse and keyboard navigations of a map in a siverlight project.

I have a very specific area that my user will be working in and don't want the user to be able to pan or zoom away from it.

I dont' want to use the Behavior that limits the extent of the map because I've not had good luck using it in the past and this application will have multiple users working in separate areas. The idea is that after the user gets to that area, navigation is disabled until they choose a different area to work in. At that point, the map will pan to the new area.

Perhaps I'm just overlooking something super easy, but I've not been able to find any kind of command to disable navigation.

Thanks for the assistance,
Will 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Disable Silverlight Map Navigation 
Author Morten Nielsen 
Date Jan 13, 2010 
Message myMap.IsEnabled = true; 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Disable Silverlight Map Navigation 
Author William Kimrey 
Date Jan 13, 2010 
Message Thanks! I knew it'd be something easy that I was just overlooking. I was assuming that "IsEnabled" would either grey the map out or disable it completely and therefore you wouldn't see anything. Guess I was looking for something explicit like "KeyboardNavigation='False'"

I did come up with a workaround that I no longer need though. I created a global Envelope that starts out empty. When initially zooming to the section the user is working on, the envelope is set to that extent. If the user did happen to zoom or pan away at that point, when the user moves to the next record in that section, I called "MyMap.ZoomTo(Envelope)".

 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Disable Silverlight Map Navigation 
Author Morten Nielsen 
Date Jan 13, 2010 
Message Alternatively you could just put a see-through grid on top of the map, to prevent it from receiving any mouse clicks or focus. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Disable Silverlight Map Navigation 
Author William Kimrey 
Date Feb 10, 2010 
Message So, I've come across and additional situation that's related to this. How do I disable mouse and keyboard navigation, but still allow the Click event? Is this even possible currently?

Alternatively, is there a way to say have a basemap disable so there's no navigation, but have a feature layer (or graphics layer) sit on top of that which allows the Click event? 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Disable Silverlight Map Navigation 
Author Morten Nielsen 
Date Feb 10, 2010 
Message No you can't disable individual layers. Remember it's the map you are disabling, not the layers.
Your best bet is using the transparent grid on top of the map to intercept mouse events. Then use these mouseevents on this grid to "simulate" clicks. You can use the GraphicsLayer.FindGraphicsInHostCoordinates method to find elements you are clicking on. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Disable Silverlight Map Navigation 
Author William Kimrey 
Date Feb 11, 2010 
Message OK, so I'm trying to use the FindGrpahicsInHostCoordinates method to grab a Graphic in a FeatureLayer. I need to get information from this graphic in order to execute a query. I'm having trouble figureing out how to use this method to get that information.

Here's what I'm doing currently. It does not give me any errors until I click on the "map" and it tries to execute this method. Then it gives me an "unable to cast" error. I guess I just need to know or at least need a hint about how to use this method properly.
 
 
private void OverlayGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Point gridClick = (Point)e.GetPosition(OverViewMap);

            FeatureLayer graphics = OverViewMap.Layers[1] as FeatureLayer;

            Graphic section = (Graphic)graphics.FindGraphicsInHostCoordinates(gridClick);
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Disable Silverlight Map Navigation 
Author Morten Nielsen 
Date Feb 12, 2010 
Message Two things you are missing. First, the method takes "host coordinates" meaning global coordinates for the app. Therefore you should change the first line to:
Point gridClick = (Point)e.GetPosition(null);


The last line has an invalid cast. It returns an ienumerable of graphics (it could be more than one) so you should instead do:
foreach(Graphic g in graphics.FindGraphicsInHostCoordinates(gridClick)) { ... }