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

Multiple destination controls

3 Answers 75 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Anatoly Chekh
Top achievements
Rank 1
Anatoly Chekh asked on 16 Nov 2010, 03:51 PM
Hello!

I have two similar situation:

1) I have a canvas and child controls that is situated by center (i.e.). Canvas and child are allowed drop. When I drag an item I want to get following scenario: First DropQuery event handled by child with, then if the query result is false (or null) - it handled by canvas itself.
But now I have following problems:

a) when I moving over child element and child element set null (or false) to query result I got incorrect RelativeDragPoint for canvas (Their don't change from after child).

b) In the some points (suggest nea border) - I got unnecessary drop impossibel info

c) If child return true for query - why drop quary event handleb on canvas?

Stack trace actions:

With child:

Drop query child status: DropDestinationQuery, x: 45, y: 21
Drop query canvas status: DropDestinationQuery, x: 45, y: 21
Drag query drag element status: DropSourceQuery, x: 45, y: 21
Drop info canvas status: DropPossible, x: 45, y: 21
Drag info drop element status: DropPossible, x: 45, y: 21

But actual coordinates is x: 233, y: 115

Near child:

Drop query child status: DropDestinationQuery, x: 44, y: 21
Drop query canvas status: DropDestinationQuery, x: 44, y: 21
Drag query drag element status: DropSourceQuery, x: 44, y: 21
Drop info canvas status: DropPossible, x: 44, y: 21
Drag info drag element status: DropPossible, x: 44, y: 21
Drop info canvas status: DropImpossible, x: 44, y: 21
Drag info drag element status: DropImpossible, x: 44, y: 21
Drop info canvas status: DropImpossible, x: 44, y: 21
Drop info canvas status: DropImpossible, x: 44, y: 21
Drag info drag element status: DropImpossible, x: 44, y: 21
Drop info canvas status: DropImpossible, x: 44, y: 21

And the second situation: when I have multiple child.
Is this a bug? Or what can I do in this situation?

Thanks, Anatoly.

3 Answers, 1 is accepted

Sort by
0
Tsvyatko
Telerik team
answered on 17 Nov 2010, 09:53 AM
Hi Anatoly Chekh,

Here are the answer for your enquies:
 

a) RelativeDragPoint holds invormation relative to the e.Options.Destination. However, all drag drop events have bubble strategy and they bubble to their parents once they are raised. You can get the relative position to an element using the following code:
var transformation = Application.Current.RootVisual.TransformToVisual(element); 
var resultPoint = transformation.Transform(e.Options.CurrentDragPoint);

b) Drop impossible is raised when leaving droppable area. This is needed since drag /drop events are not raised when mouse is not dropppable element.

c) Could you please share some additional information about this issue.

Greetings,
Tsvyatko
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
Anatoly Chekh
Top achievements
Rank 1
answered on 17 Nov 2010, 02:55 PM
Additinal information:

Sample:

<Canvas Width="500" Height="500">

      <Grid Width="100" Height="100" Canvas.Left="100" Canvas.Top="100" />

</Canvas>

The canvas and grid are allow drop.

I move some elemen. First grid handles guery event and return true. Then Canvas handles query event. Current query result is true. If I return false - it will be means that grid element will be ignored as dropped possible element.
And the I get two drop possible infon event drop possible on grid and canvas.
0
Anatoly Chekh
Top achievements
Rank 1
answered on 19 Nov 2010, 01:00 PM
Also I found following problem:

I add DropInfo handlers to canvas and grid, (I.e. I want to set allow drop dynamically). But and in this case I catch drop info event in canvas. But canvas isn't allow drop!

Thanks, Anatoly.
Tags
DragAndDrop
Asked by
Anatoly Chekh
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Anatoly Chekh
Top achievements
Rank 1
Share this question
or