Gestures

3745
6
06-02-2011 08:27 AM
GregoryDillon
New Contributor III
Can anybody point me to an example of how to use gestures in 2.1.    I'm most interested in using the drag gesture to pan the map.    The map automatically seems to understand my pinch gestures to zoom.   Why doesn't it do the pan automatically (do I need to do something special)?

I tried the following code to get any gesture (no message box appears):

private void MyMap_MapGesture(object sender, Map.MapGestureEventArgs e)
        {
           GestureType Gest = e.Gesture;

           MessageBox.Show("Test" + Gest.ToString());
           if (Gest == GestureType.Drag)
           {
               //ESRI.ArcGIS.Client.Map.MouseEventArgs mouseEventArgs = new ESRI.ArcGIS.Client.Map.MouseEventArgs();
               //mouseEventArgs.MapPoint = e.MapPoint;
               MyMap.PanTo(e.MapPoint);
           }
        }


I'm testing this on an HP Slate which seems to understand gestures in my old ADF solution.
0 Kudos
6 Replies
dotMorten_esri
Esri Notable Contributor
Both pan,  and pinch-zoom should just work out of the box. You don't need to handle the gesture event to do that (ie the code you have that does the Map.PanTo would only serve to break the pan behavior).
Also showing the MessageBox during a gesture will really bring havoc to the whole deal, since the map would loose focus the second you touch the map.
0 Kudos
GregoryDillon
New Contributor III
Both pan,  and pinch-zoom should just work out of the box. You don't need to handle the gesture event to do that (ie the code you have that does the Map.PanTo would only serve to break the pan behavior).
Also showing the MessageBox during a gesture will really bring havoc to the whole deal, since the map would loose focus the second you touch the map.


I realize the issue with the messagebox, I was just trying to get some response to my gestures.  It seems the MapGesture event is broken.  I agree the the pan should work out of the box, but it doesn't despite the fact the pinch zoom does.   

Is there something special I need to do to the application (like a special HTML or Silverlight header or tag)?  

Is there is a setting on the device I need to enable?  

My ADF application on the same device works fine.

I also discovered that the on screen keyboard does not work when in Full Screen mode (I suspect this is a Silverlight 4/Win 7/IE8 bug).
0 Kudos
GregoryDillon
New Contributor III
Just as a follow up - the keyboard not working at full screen seems to be a Silverlight security feature (its disable whether or not its a on screen or hard wired keyboad).   Because of this I will be removing the full screen from my web site.   I need the user to be able enter text for some of the queries.  Seems pressing the F11 key enables a browser level full screen (IE8) while still allowing keyboard input.   

Does anybody know way to go full screen with the keyboard enable?

I also tried removing all the mouse and gesture events associated with my map and layout root thinking they were causing a conflict, but that still did not enable the pan. 

I tried the online samples and the pan does work.   So this does seem to be something in my solution preventing the pan.   I just can't figure out what it is.    I'm open to any suggestions to hunt this down.   Has anybody else seen this behavior?
0 Kudos
GregoryDillon
New Contributor III
Okay I finally figured this out. If you use the <param name="Windowless" value="true" /> on your Silverlight Object tag in your html or aspx page it disables the pan gesture (pinch and expand gestures still work).  It also seems to work better with my HP Slate as the other setting sometime crashes on gestures.    BTW: I believe I got that code from the default template (may that should be removed?).
0 Kudos
johnbrosowsky
Occasional Contributor II
is there a way to get pan to work even when using <param name="Windowless" value="true" /> ?
0 Kudos
SrihariManepalli
New Contributor II

Does anyone have any update on this?

We are also facing the same issue. Touch Events like Map pan and Tap is not working when windowless parameter is true.

0 Kudos