Drag & Drop buttons not firing click event

4 posts, 0 answers
  1. Sehe
    Sehe avatar
    14 posts
    Member since:
    Jun 2011

    Posted 18 Jan 2012 Link to this post

    Hello,

    I have an application that can drag and drop buttons between borders. I have the drag drop working.

    The problem is the button click event seems to be blocked when I set the AllowDrag property to true. I can still see a double click event, just not the actual click event.
    <Button Content="drop btn"
    Click="Button_Click_1" 
    telerikDragDrop:RadDragAndDropManager.AllowDrag="True"
    MouseDoubleClick="Button_MouseDoubleClick" />

    Thanks for the help.
    Scott
  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 19 Jan 2012 Link to this post

    Hello Scott,

    You can set the ClickMode property of the button to Press. This will enable both Dragging and clicking it.

    Hope this helps!

    Regards,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Sehe
    Sehe avatar
    14 posts
    Member since:
    Jun 2011

    Posted 19 Jan 2012 Link to this post

    If I set the clickmode = "press" the click event will fire as soon as I press the button. This fires whether I'm trying to click it or drag it. I don't need/want the click event to fire when dragging the button.

    If I set the clickmode = "release" nothing fires. Is the click event somehow getting handled in the drag&drop manager?

    Thanks,

    Scott
  5. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 23 Jan 2012 Link to this post

    Hello Scott,

    The RadDragAndDropManager uses the PreviewLeftMouseButtonDown 
    event of the control in order to initialize the drag drop operation. However, Button captures mouse events on mouse left button down.  As a result we would be not able to hook to it and use it further in the drag drop mechanism. Therefore we are obligated to use the PreviewLeftMouseButtonDown (triggered by allowCapturedDrag), since it fires prior to the Click event. The reason that the ClickMode="Release" does not work is due to the fact that in this situatuation click event is raised on mouseleftbuttonUp (which will not be recieved from the button as it no longed has mouse capture).

    Hope this clarifies the behavior! 

    All the best,
    Tsvyatko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top