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

2 posts, 1 answers
  1. Mark
    Mark avatar
    1 posts
    Member since:
    Jul 2019

    Posted 02 Jul Link to this post

    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.

  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    3100 posts

    Posted 03 Jul Link to this post

    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.
Back to Top