How to: reorder items within wrappanel

4 posts, 1 answers
  1. Daniel
    Daniel avatar
    23 posts
    Member since:
    May 2009

    Posted 28 Nov 2012 Link to this post


    it is posible to use RadListbox to reorder items by drag&drop whihe wrappanel is set as ItemsPanel?

    <telerik:RadListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
          <Style TargetType="telerik:RadListBoxItem" BasedOn="{StaticResource RadListBoxItemStyle}">
            <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
          <telerik:ScreenshotDragVisualProvider />
          <telerik:ListBoxDragDropBehavior AllowReorder="True"  />
            <WrapPanel />
  2. Answer
    Vladi avatar
    749 posts

    Posted 03 Dec 2012 Link to this post

    Hello Daniel,

    To enable the drag and drop reorder of items in RadListBox control when using WrapPanel as ItemsPanel you will need to create a CustomLinearDropVisualProvider that inherits LinearDropVisualProvider and override its GetLocation() method.

    I created and attached a sample project for you showing the described approach.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Moe
    Moe avatar
    5 posts
    Member since:
    Oct 2009

    Posted 18 Dec 2015 in reply to Vladi Link to this post

    I know this post is old, but I used the code in the attached project and encounter a bug.

    The  LinearDropVisual disappear when scrolling to items beyond the screen (listbox with large items). Or if you scroll to items then drag the visual also disappear.

    Any help is appreciated


  4. Polya
    Polya avatar
    242 posts

    Posted 22 Dec 2015 Link to this post

    Hello Mohamed Elsheihh,

    This behavior of the RadWrapPanel is known to us and is related to the calculation of a container's position inside this panel. Unfortunately we cannot propose a workaround using a RadWrapPanel as it inherits from System.Windows.Controls.Panel.

    Instead, I suggest using the VirtualizingWrapPanel instead where the position of a RadListBoxItem is differently calculated, because this panel inherits from System.Windows.Controls.VirtualizingPanel.

    Hope this helps.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top