This is a migrated thread and some comments may be shown as answers.

Resize Map Shapes demo stops mouse tracking with later version of Telerik controls

1 Answer 73 Views
Map
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 02 Jul 2019, 03:51 PM

I ran the demo called Resize Map Shapes with Mouse Dragging (https://docs.telerik.com/devtools/wpf/controls/radmap/how-to/howto-resize-map-shapes-with-mouse-dragging)

which I downloaded from the associated web page (https://www.telerik.com/blogs/radmap-for-silverlight-wpf-how-to-resize-map-shapes-with-mouse-dragging)

and it worked fine.

I updated the controls to WPF40 version 2018.3.1016.40 and it it now acts differently.  When dragging, it loses mouse capture.  If I release the left mouse button and move the cursor back over the draggable circle it then continues to drag (won't do anything if I don't release the left mouse button).

I also tried this using WPF45 version 2018.3.1016.45 and the same problem (and changing my app's .Net version to 4.6.1).

Attached are two animated gifs showing the original version working and the replaced dll version's odd behavior.

I tracked GotMouseCapture, IsMouseCaptureChanged and LostMouseCapture and recorded this:

12:39.122 IsMouseCaptureChanged
12:39.122 GotMouseCapture
12:39.122 IsMouseCaptureChanged
12:39.122 LostMouseCapture

I didn't change the MainWindow.xaml.cs at all.  I just removed the references to the 3 Telerik controls, removed the controls from the binaries folder, added the newer Telerik controls to the binaries folder, and added the references back.  I'm using Visual Studio 2017.

1 Answer, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 03 Jul 2019, 08:42 AM
Hello Mark,

We improved Mouse capturing in RadMap in 2011 and that is why handling the MouseMove event in the example is mandatory now.

private void pinPoint_MouseMove(object sender, MouseEventArgs e)
  {
      if (!this.isDragging)
          return;
 
      var pinPoint = sender as MapPinPoint;
      var oldLocation = MapLayer.GetLocation(pinPoint);
      var location = Location.GetCoordinates(radMap, e.GetPosition(radMap));
      MapLayer.SetLocation(sender as DependencyObject, location);
 
      var polyline = this.polylineLayer.Items[0] as MapPolyline;
      for (int i = 0; i < polyline.Points.Count; i++)
      {
          var locationPoint = polyline.Points[i];
          if (locationPoint == oldLocation)
          {
              polyline.Points[i] = location;
              break;
          }
      }
   e.Handled = true;
  }


The documentation article should be updated in a couple of hours with the mentioned code change.




Regards,
Petar Mladenov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Map
Asked by
Mark
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or