Change Mouse Cursor when hovering a feature

4298
5
11-23-2011 04:23 AM
oo
by
New Contributor
Is there a simple way to change the mouse cursor when I roll over an object (e.g. a street) on a feature layer? How?
Is the same possible for a DynamicMapServiceLayer e.g. via it's GraphicsLayer?
0 Kudos
5 Replies
JenniferNery
Esri Regular Contributor
These threads seem related:
http://forums.arcgis.com/threads/21708-Does-arcgis-provide-a-Pan-cursor.
http://forums.arcgis.com/threads/8182-Map-Cursors

Features in ArcGISDynamicMapServiceLayer do not receive mouse events. You would have to use FeatureLayer to enable this.
0 Kudos
OrenGal
New Contributor III
Maybe you find this post helpful. Change the cursor after querying the server.
http://www.gal-systems.com/2011/09/showing-arcgis-dynamic-layer-maptips.html
Oren.
0 Kudos
oo
by
New Contributor
Thanks for the links.
I do not need a custom cursor. My plan was to listen to the feature layer's MouseEnter/Leave events and then trigger a cursor change (to another default cursor) like "Map.setMapCursor("pointer")" in the JavaScript API. But I can't find an equivalent method in the SiverLight API. What can I do?
0 Kudos
DominiqueBroux
Esri Frequent Contributor

like "Map.setMapCursor("pointer")" in the JavaScript API. But I can't find an equivalent method in the SiverLight API. What can I do?

There is a Cursor property on the Map.
By wiring up the MouseEnter and MouseLeave FeatureLayer events, you can change the cursor with code like:
 
private void FeatureLayer_MouseEnter(object sender, GraphicMouseEventArgs e)
{
  MyMap.Cursor = Cursors.Hand;
}
private void FeatureLayer_MouseLeave(object sender, GraphicMouseEventArgs e)
{
  MyMap.Cursor = Cursors.Arrow;
}
0 Kudos
oo
by
New Contributor
Thank you! That's what I was looking for.
0 Kudos