This is a migrated thread and some comments may be shown as answers.

Drag&Drop and Grouping between 2 RadListBox

0 Answers 97 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Vedha
Top achievements
Rank 1
Vedha asked on 12 Apr 2013, 02:43 AM
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-->
<Style x:Key="DraggableListBoxItem" TargetType="telerik:RadListBoxItem">
            <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
        </Style>
 
<!--SOURCE RADLISTBOX-->
<telerik:RadListBox Grid.Column="0" ItemContainerStyle="{StaticResource DraggableListBoxItem}"
                            ItemsSource="{Binding ProductosTotal.View}" ItemTemplate="{StaticResource ListBoxItemTemplate}">
                            <telerik:RadListBox.GroupStyle >
                                <GroupStyle>
                                    <GroupStyle.HeaderTemplate>
                                        <DataTemplate>
                                            <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}"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </GroupStyle.HeaderTemplate>
                                </GroupStyle>
                            </telerik:RadListBox.GroupStyle>
 
                            <telerik:RadListBox.DragDropBehavior>
                                <Behaviors:ListBoxDragDropBehaviorCopy />
                            </telerik:RadListBox.DragDropBehavior>
                            <telerik:RadListBox.DragVisualProvider>
                                <telerik:ScreenshotDragVisualProvider />
                            </telerik:RadListBox.DragVisualProvider>
                        </telerik:RadListBox>
 
<!--DESTINATION RADLISTBOX-->
 <telerik:RadListBox  Grid.Row="1" ItemsSource="{Binding ProductosPedido}" AllowDrop="True"
                            ItemTemplate="{StaticResource ListBoxItemTemplate}">
                        <telerik:RadListBox.DragDropBehavior >
                            <telerik:ListBoxDragDropBehavior />
                        </telerik:RadListBox.DragDropBehavior>
                    </telerik:RadListBox>

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

No answers yet. Maybe you can help?

Tags
ListBox
Asked by
Vedha
Top achievements
Rank 1
Share this question
or