Does this support Drag and drop within 2 different List Boxes as well within a Listbox as well. My use case is i would want to change ordering of items on my listbox as well as drag and drop from another listbox as well. Is there a sample you could provide to demo this capability.
Cheers,
Raul
HI,
Here is a inter-listbox drag and drop sample using our Drag&Drop Framework
Sincerely,
Matt Developer Support Enginere
Hi Matt,
I would want a drag drop to work
a) within a single listbox so as to change ordering of elements in a listbox.
b) it should also be droppable, so other listbox items should be able to drop into it
c) It should be draggable. so you could drag from this and drop into another listbox.
I tried playing around with the sample you gave me so as to extend it to the above use case but I couldn't get it to work.
I am attaching an Inter and Intra Listbox Drag and Drop Application.
Matt Developer Support Engineer
Thanks for this, I was able to extend yr sample to cover all my use cases. However when I drag all items from Listbox A onto ListBox B, after that I was unable to drag back items onto Listbox A.
<Window x:Class="WpfApplication209.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:WpfApplication209.ViewModel" xmlns:ig="http://schemas.infragistics.com/xaml" Title="MainWindow" Height="350" Width="525"> <Grid DataContext="{StaticResource vm}"> <Grid.Resources> <DataTemplate x:Key="dt"> <Rectangle Fill="red" Width="14" Height="15"/> </DataTemplate> </Grid.Resources> <Grid.ColumnDefinitions> <ColumnDefinition Width="100"/> <ColumnDefinition Width="auto"/> </Grid.ColumnDefinitions> <ListBox ItemsSource="{Binding People}" Grid.Column="0"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" > <ig:DragDropManager.DragSource> <ig:DragSource DragChannels="a,b" DragTemplate="{StaticResource dt}" DragStart="DragSource_DragStart" Drop="DragSource_Drop" IsDraggable="True"/> </ig:DragDropManager.DragSource> <ig:DragDropManager.DropTarget> <ig:DropTarget DropChannels="b" IsDropTarget="true"/> </ig:DragDropManager.DropTarget> <TextBlock Margin="0,0,3,3" Text="{Binding Name}"/> <TextBlock Text="{Binding State}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <ListBox ItemsSource="{Binding Choosen}" Grid.Column="1" MinWidth="100"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel AllowDrop="True" Orientation="Horizontal" > <ig:DragDropManager.DragSource> <ig:DragSource DragChannels="b" DragStart="DragSource_DragStart" Drop="DragSource_Drop" IsDraggable="True"></ig:DragSource> </ig:DragDropManager.DragSource> <ig:DragDropManager.DropTarget> <ig:DropTarget DropChannels="a" IsDropTarget="true"/> </ig:DragDropManager.DropTarget> <TextBlock Margin="0,0,3,3" Text="{Binding Name}"/> <TextBlock Text="{Binding State}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid> </Window>
I am attaching a new sample that does bi-directional drag and drop.
Matt
Developer Support Engineer
I was able to extend it to bidirectional drag and drop, however the challenge is when I drag off all items from one listbox to another I cannot add them back.
Here is a new sample that will allow drop when the ListBox is empty.
Sincerely, Matt Developer Support Engineer