Dragging shapes

2 posts, 0 answers
  1. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 27 Aug 2014 Link to this post

    Hi Guys,

    A while back we were in contact with you regarding dragging shapes without they change position. TicketID: 662635.

    We implemented the solution you guys suggested.

    Now we have discovered a bug regarding the way we drag shapes.

    The problem is because we set Handled = true in DragPreview, when dragged shape is dropped outside the diagram, the drag operation is never ended.

    Issue here is we implemented a DragAdorner that follows the cursor, and when it re-enters the diagram the drag operation is still active. Even though the mouse button is not pressed. The issues also exists in the sample projects from the support ticket. (No dragTemple, but changed cursor)

    Is there a way we can end the drag operation, when MouseLeftButtonUp occurs outside diagram.

  2. Martin
    Martin avatar
    1048 posts

    Posted 29 Aug 2014 Link to this post

    Hello Jesper,

    The reported behavior is caused by the WPF framework and is not directly related to the RadDiagramControl itself. As I can see in the project that my colleague Peter provided you the drop logic and the canceling of the drag operation are executed in the LeftMouseButtonUp event. This event is never called because when you mouse up outside the window the mouse is not captured by default and the window doesn't know that the mouse is up. 

    In order to resolve this you can capture the mouse when you start the drag operation and release it again when the drop is executed.

    private void diagram_PreviewDrag_1(object sender, DragRoutedEventArgs e)
    void diagram_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)

    Please let me know if this helps.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. DevCraft banner
Back to Top