Select to view content in your preferred language

How to change the cursor when doing measure action?

912
4
03-01-2011 06:37 PM
DanDong
Deactivated User
Hi all,

I want to change the cursor from hand shape to arrow shape when doing measure action. I have changed the measure action from XAML to code-behind.
private void Measure_Click(object sender, System.Windows.RoutedEventArgs e)
{
MyMap.Cursor = Cursors.Arrow;   //change the cursor to arrow shape
MyMeasureAction m = new MyMeasureAction();  //initialize a MyMeasureAction class
m.MeasureMode = ESRI.ArcGIS.Client.Actions.MeasureAction.Mode.Polygon;  //MeasureMode is polygon
m.DisplayTotals = false;    //do not display total distance
m.FillSymbol = LayoutRoot.Resources["DrawFillSymbol"] as FillSymbol;
m.DistanceUnit = ESRI.ArcGIS.Client.Actions.DistanceUnit.Feet;
m.MapUnits = ESRI.ArcGIS.Client.Actions.DistanceUnit.Feet;  //the unit of the map is Feet
m.Attach(MyMap);    //bind this action to MyMap
m.Execute();    //execute this action
}


But the weird thing is when I hit the button, the cursor cannot be changed to arrow shape. If I put this line under other button click events. It works.
MyMap.Cursor = Cursors.Arrow;


I guess this might due to the measure action itself? In the sample, it use hand cursor to perform measure action. Is there any method to change the cursor shape? Thank you! 🙂
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
This is by design, map.Cursor is changed to Cursors.Hand while MeasureAction is active and then changed back to previous cursor when disabled.
0 Kudos
DanDong
Deactivated User
This is by design, map.Cursor is changed to Cursors.Hand while MeasureAction is active and then changed back to previous cursor when disabled.


Does that mean I cannot change the cursor shape when measure action is doing its work?
0 Kudos
JenniferNery
Esri Regular Contributor
MeasureAction already overrides the map cursor and cannot be changed, sorry.
0 Kudos
DanDong
Deactivated User
MeasureAction already overrides the map cursor and cannot be changed, sorry.


Ok �?�? at least I know that we cannot change it. Thank you Jennifer 🙂
0 Kudos