I have 2 databound TreeViews and a Label. The requirement is to drag an item from the Tree1 onto the label, and this would add the item to Tree2. (without removing the item from Tree1) Both trees are bound to objects of the same type.
I have added a Handler for the DropInfoEvent on the Label, and add the payload to Tree2. The code in the Handler executes correctly and does not throw an error. The ItemsSource of Tree2 shows that it has the added Item(s) if subsequent events, but the Tree2 never updates. (always shows original list)
void
lblContextName_OnDropInfo(
object
sender, DragDropEventArgs e)
{
if
(e.Options.Status == DragStatus.DropComplete)
{
System.Collections.IList list =
(tree2.ItemsSource
as
System.Collections.IList);
foreach
(TempResource tr
in
(System.Collections.IList)e.Options.Payload)
{
list.Add(tr);
}
e.Handled =
true
;
}
}
Thanks,
Justin