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

Drag & Drop buttons not firing click event

3 Answers 670 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Sehe
Top achievements
Rank 1
Sehe asked on 18 Jan 2012, 09:23 PM
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

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 19 Jan 2012, 01:28 PM
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 >>

0
Sehe
Top achievements
Rank 1
answered on 19 Jan 2012, 03:04 PM
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
0
Tsvyatko
Telerik team
answered on 23 Jan 2012, 10:30 AM
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 >>

Tags
DragAndDrop
Asked by
Sehe
Top achievements
Rank 1
Answers by
Nick
Telerik team
Sehe
Top achievements
Rank 1
Tsvyatko
Telerik team
Share this question
or