I have implemented MapTool functionality where I am calling the tool using ICommand.Execute(). Everything is working fine. On mouse down, I am able to fetch the MapPoints X/Y. But when I hoover on the Map the cross-hair cursor is not displaying instead the Hand cursor is displaying.
Any idea how to resolve the issue.
Below are the codes:
protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
{
//On mouse down check if the mouse button pressed is the left mouse button. If it is handle the event.
if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
e.Handled = true;
}
/// <summary>
/// Called when the OnToolMouseDown event is handled. Allows the opportunity to perform asynchronous operations corresponding to the event.
/// </summary>
protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
{
//Get the map coordinates from the clicked point and set the property on the ViewModel.
return QueuedTask.Run(() =>
{
var mapPoint = ActiveMapView.ClientToMap(e.ClientPoint);
sb.Append(string.Format("{0}", mapPoint.X));
sb.Append(string.Format("#{0}", mapPoint.Y));
if (mapPoint.HasZ)
{
sb.Append(string.Format("#{0}", mapPoint.Z));
}
Application.Current.Properties["Coordinate"] = sb.ToString();
sb.Clear();
});
}
Solved! Go to Solution.
Try overriding OnToolActivateAsync and set the Cursor property like so:
Cursor = Cursors.Cross; //Cursors is in the System.Windows.Input namespace.
That should work.
Kris
Try overriding OnToolActivateAsync and set the Cursor property like so:
Cursor = Cursors.Cross; //Cursors is in the System.Windows.Input namespace.
That should work.
Kris