Multiple destination controls

4 posts, 0 answers
  1. Anatoly Chekh
    Anatoly Chekh avatar
    86 posts
    Member since:
    Apr 2010

    Posted 16 Nov 2010 Link to this post

    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.
  2. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 17 Nov 2010 Link to this post

    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>>
  3. DevCraft banner
  4. Anatoly Chekh
    Anatoly Chekh avatar
    86 posts
    Member since:
    Apr 2010

    Posted 17 Nov 2010 Link to this post

    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.
  5. Anatoly Chekh
    Anatoly Chekh avatar
    86 posts
    Member since:
    Apr 2010

    Posted 19 Nov 2010 Link to this post

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