I am interested in being able to drag multiple items from a SL Listbox to a xamDataTree using the DragDropManager. Is that possible? Even though I have my listbox set to SelectionMode="Extended", when I start dragging the DragDropStartEventArgs Data property is set to only one of the selected items. I have seen other posts about dragging multiple XamGridRows, but none of them seem to apply to a ListBox. Any help would be appreciated.
<ListBox x:Name="lbFilteredContacts" ItemsSource="{Binding FilteredContacts}" SelectionMode="Extended" MaxHeight="300" MinWidth="300" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="5" Visibility="{Binding ContactListVisible}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Source="{Binding image}" Height="16" Width="16" Margin="5"/> <TextBlock Text="{Binding fullName}" Margin="5"/> <ig:DragDropManager.DragSource> <ig:DragSource x:Name="dsListBox" IsDraggable="True" Drop="dsListBox_Drop" DataObject="{Binding}" DragStart="dsListBox_DragStart"/> </ig:DragDropManager.DragSource> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
Hello,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically in the DragStart event handler I set the Drag’s Data to be the SelectedItems, and also create a DataTemplate for the DragTemplate, so I can show all the selected Items. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Perfect. Just what I needed. Thank you
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.