Reordering Expander inside the Stackpanel

2 posts, 0 answers
  1. Sakthi
    Sakthi avatar
    7 posts
    Member since:
    Sep 2012

    Posted 26 Sep 2012 Link to this post

    Hi All,

    I want to Reorder the RasExpander Control with the help of DragDropManager inside the Stackpanel. Can you please guide me how to do this? Please help me with the sample if possible.

  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1251 posts

    Posted 29 Sep 2012 Link to this post

    Hi Sakthi,

    I understand that you need  to move RadExpander control which could be a bit tricky, because the DragDropManager works best with data objects rather than UIElements. This is why it might be easier if you define the RadExpanders in a ListBox.ItemTemplate and build their content based on data items.Then you'll be able to use the approach described in the DragDropManager GettingStarted article or the ListBoxDragDropBehavior to reorder the items in the ListBox control.

    However, there is a way to achieve this:
    • First you have to set to True the telerik:DragDropManager.AllowCapturedDrag and AllowDrop properties of all RadExpander controls that you need to move.
    • Then you have to attach a Drag Initialize Handler and a Drop Handler by using AddDragInitializeHandler and AddDropHandler methods of the DragDropManager. In your case this must be done manually for each expander.

    Please find the attached project bellow. And let me know if it satisfies your needs.

    All the best,
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Back to Top