DragAndDrop in Accordion

7 posts, 0 answers
  1. Moon Yau
    Moon Yau avatar
    12 posts
    Member since:
    Mar 2009

    Posted 22 Jul 2009 Link to this post

    I wish to add the DragAndDrop ability in Accordion (Silverlight Toolkit)
    Can you give me a simple example on how to implement this?

  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 22 Jul 2009 Link to this post

    Hello Moon Yau,

    Could you be more specific what kind of DragDrop you like to implement - e.g. item reorder, dragging to another control or from another control, etc.

    The initial difficulty in implementing the DragDrop is to get to the elements that you want to be drag sources or drop destinations. There should be a way to set the AllowDrop and AllowDrag attached properties.

    Then it is a matter of handling routed events that can be handled anywhere on a parent in the visual tree.

    Please note that elements that capture the mouse on mouse down cannot be successfully dragged because they handle all mouse events in doing so.

    Could you please be more specific or ideally send us a sample solution with the accordion setup. I will be happy to help you with any difficulties you encounter.

    All the best,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Moon Yau
    Moon Yau avatar
    12 posts
    Member since:
    Mar 2009

    Posted 22 Jul 2009 Link to this post

    I would like to do something like a list box with dragdrop and also the item can be expanded.
    That's why I am thinking to implement DragDrop in Accordion that suit my need.

    And seems that accordion had captured the mousedown event as you mentioned, so is it still possible to implement in this way?

    Besides, Is item RadPanelBar can be dragdrop?
    If it is, can you provide me the example in databinding, where the item content is in Grid/Stackpanel like container?

    Thanks.
  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 22 Jul 2009 Link to this post

    Hello Moon Yau,

    The RadPanelBar is different than the accordion because it hierarchical control and when bound you need the content of each item to be exposed as an IEnumerable property of its parent. As far as I understand this may not be the case with you.

    My suggestion is to add a Header/HeaderTemplate for each accordion item and set the allow drop property to an object there (it can be a TextBlox / Grid, etc). This will work only if the accordion does not place an object over them in the visual tree and they are HitTestVisible. (I.e. their IsHitTestVisible property is not set to false).

    Does this work for you?

    Sincerely yours,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Moon Yau
    Moon Yau avatar
    12 posts
    Member since:
    Mar 2009

    Posted 22 Jul 2009 Link to this post

    I do have the DataTemplate(HeaderTemplate of accordion) for my accordion.
    And I have tried to use your method that set the Allow DragDrop property on the Textblock.

    Mostly it did not trigger the DragEvent when I attempt to drag and move the item in accordion, but sometimes it does.
    When it trigger, I able to drag the item (transparent floating item) around but there is no drop place, if I try to drop on any item in accordion, it just cancel the drag.

    I not sure I am doing it right. Can you please provide me an example that it work on accordion with dragdrop?

    Thanks.

  7. Moon Yau
    Moon Yau avatar
    12 posts
    Member since:
    Mar 2009

    Posted 24 Jul 2009 Link to this post

    Hi, Is there any example/solution yet? 
    If it is not, I may need to consider other control instead stuck on Implementing DragDrop on Accordion.
  8. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 28 Jul 2009 Link to this post

    Hi Moon Yau,

    I had a better look at the Accordion control. It seems it handles the mouse on mouse down (just like a button) if you are trying to drag an item.

    Unfortunately this means that currently the DragDrop will not work.

    Greetings,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
DevCraft banner