Drag&Drop and Grouping between 2 RadListBox

1 posts, 0 answers
  1. Vedha
    Vedha avatar
    2 posts
    Member since:
    Apr 2013

    Posted 11 Apr 2013 Link to this post

    Hi, thanks ins advance for reading this

    I've been able to reproduce the Drag&Drop and Grouping examples separately. No luck making them work together.

    My 2 collections and filling the source list.
    Property ProductosTotal As New CollectionViewSource
    Property ProductosPedido As New ObservableCollection(Of Productos)
    'Called when initializing view
    Private Sub LoadProductosTotal()
            Dim prods = operacionesProductos.GetAllProductos()
            If prods IsNot Nothing Then
                ProductosTotal = New CollectionViewSource
                ProductosTotal.Source = prods
            End If
        End Sub

    On the Xaml side:
    <Style x:Key="DraggableListBoxItem" TargetType="telerik:RadListBoxItem">
                <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
    <telerik:RadListBox Grid.Column="0" ItemContainerStyle="{StaticResource DraggableListBoxItem}"
                                ItemsSource="{Binding ProductosTotal.View}" ItemTemplate="{StaticResource ListBoxItemTemplate}">
                                <telerik:RadListBox.GroupStyle >
                                                <StackPanel Height="Auto" Background="{telerik:Windows8Resource ResourceKey=AccentBrush}" Margin="0 5 0 5">
                                                    <TextBlock Text="{Binding Name}" FontFamily="Segoe UI Light" FontWeight="Bold" FontSize="16"
                                               Margin="10 3 0 0" Foreground="{telerik:Windows8Resource ResourceKey=MainBrush}"/>
                                    <Behaviors:ListBoxDragDropBehaviorCopy />
                                    <telerik:ScreenshotDragVisualProvider />
     <telerik:RadListBox  Grid.Row="1" ItemsSource="{Binding ProductosPedido}" AllowDrop="True"
                                ItemTemplate="{StaticResource ListBoxItemTemplate}">
                            <telerik:RadListBox.DragDropBehavior >
                                <telerik:ListBoxDragDropBehavior />

    Notice the ListBoxDragDropBehaviorCopy I inherited the ListBoxDragDropBehavior to supress the remove operation because it threw an exception.

    I need to copy from the source list, not move, I've tried the DragDropManager but I cant understand completely the documentation.
    Could someone point me in the right direction, i feel like is something small what im missing

    Thanks again

Back to Top