I am havig problems grasping the event handlers. I understand each one and its purpose, what I dont understand is what commands to put in the even that handles the drag from the treeView. The treeview items shud be dragged to populate the listbox, but not removed. So basically, each drag will copy the item into the list box, which means multiple instances of one item can exist in the list box. I want ot know how to create the on drag query and info events for the tree, as the demo has not helped me as adequately as I hoped it would have. I have this, for the list box on drophandler event, I am not sure what should go into the dropquery function.
private void OnListDropHandler(object sender, DragDropEventArgs e)
{
System.Windows.Controls.ItemsControl LessonList = e.Options.Destination as System.Windows.Controls.ItemsControl;
ICollection draggedItems = e.Options.Payload as ICollection;
// Get the drag cu that the TreeView or we have created
TreeViewDragCue cue = e.Options.DragCue as TreeViewDragCue;
if (e.Options.Status == DragStatus.DropPossible)
{
// Set a suitable text:
cue.DragActionContent = String.Format("Add {0} item{1} to Lesson List", draggedItems.Count, draggedItems.Count > 1 ? "s" : String.Empty);
cue.IsDropPossible = true;
//order.Background = this.Resources["DropPossibleBackground"] as Brush;
}
else if (e.Options.Status == DragStatus.DropImpossible)
{
cue.DragActionContent = null;
cue.IsDropPossible = false;
}
else if (e.Options.Status == DragStatus.DropComplete)
{
IList items = LessonList.ItemsSource as IList;
foreach (object draggedItem in draggedItems)
{
items.Add(draggedItem);
}
}
if (e.Options.Status != DragStatus.DropPossible)
{
LessonList.Background = new SolidColorBrush(Colors.White);
}
}
is this ok? and how would I go about setting up the rest?
Thanks in advance