How can I disable the zoomin function when double clicking on the map?

1003
6
02-21-2011 06:06 PM
DanDong
Deactivated User
Hi all,

I just want to use double clicking to close the polygon that I draw, but it seems that silverlight performs zooming in when you double click on the map by default. What can I do to disable this function? Any suggestions? Thank you!! 🙂
0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor
From this sample : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#DrawGraphics, it doesn't seem that double clicking is zooming in while the draw is active.
Could you give more info about your issue?

Thanks
0 Kudos
DanDong
Deactivated User
From this sample : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#DrawGraphics, it doesn't seem that double clicking is zooming in while the draw is active.
Could you give more info about your issue?

Thanks


Thank you Dominique! I went through the codes behind this sample. But I cannot figure out where dose this sample disable the zoom in function when double clicking on the map.

Basically, in my code, I use mouseclick to get the points, then store those points into a pointcollection:
pPointCollection.add(new ESRI.ArcGIS.Client.Geometry.MapPoint(args.MapPoint.X, args.MapPoint.Y))


Then add the pointcollection to Path, generate graphic based on the polyline and add this graphic into the graphics layer
paths.Add(pPointCollection);
pPolyline.Paths=path;
ESRI.ArcGIS.Client.Graphic graphic =new ESRI.ArcGIS.Client.Graphics()
{
       geometry=pPolyline,
       symbol=lineSymbol
};
graphicsLayer.Graphics.Add(graphic);


In the mouseLeftButtonDown event, I was going to handle the double clicking.
0 Kudos
JenniferNery
Esri Regular Contributor
If you are using Draw class as in the sample, while Draw.IsEnabled=true you will not be able to navigate the map through pan or zoom.

If you are not using Draw and would like to disable zoom from double click, you can mark MouseLeftButtonDown event as e.Handled=true. This should prevent both pan and zoom.
0 Kudos
DanDong
Deactivated User
If you are using Draw class as in the sample, while Draw.IsEnabled=true you will not be able to navigate the map through pan or zoom.

If you are not using Draw and would like to disable zoom from double click, you can mark MouseLeftButtonDown event as e.Handled=true. This should prevent both pan and zoom.


Thank you Jennifer! I used e.Handled=true to disable the zooming in function. 🙂
0 Kudos
DanDong
Deactivated User
Hi Jennifer, I use MouseClick event to add point. If I mark e.handled = true in MouseLeftButtonDown event, this will also prevent the MouseClick event. So sometimes I cannot add point. Both MouseClick and MouseLeftButtonDown events share a same handler. Is there other way that I can prevent zooming/pan functionality? Thank you!:)
0 Kudos
JenniferNery
Esri Regular Contributor
That is right, MouseClick event is dependent on MouseLeftButtonDown and MouseLeftButtonUp events and will not fire if MouseLeftButtonDown had been marked handled. Can you use MouseLeftButtonDown event to perform the add instead? In doing so, you can mark the same event handled to prevent zoom on Double click.
0 Kudos