I'm trying to get the underlying object that's bound to a dropped item in a drag-drop operation. In my case the underlying object is of type Model.Topic.
I use the following code:
The question is, what is the correct way to get the underlying object that is bound to a dragged/dropped item?
I use the following code:
private void RadTreeView_DragEnded(object sender, Telerik.Windows.Controls.RadTreeViewDragEndedEventArgs e) |
{ |
object droppedTopics = e.DraggedItems; |
object targetDropItem = e.TargetDropItem; |
Model.Topic targetTopic = targetDropItem as Model.Topic; |
foreach (object droppedTopic in e.DraggedItems as Collection<object>) |
{ |
Model.Topic sourceTopic = droppedTopic as Model.Topic; |
targetTopic.ParentTopicId = sourceTopic.ID; |
} |
} |
The problem is that after the following line, targetTopic is always null.
Model.Topic targetTopic = targetDropItem as Model.Topic; |
The question is, what is the correct way to get the underlying object that is bound to a dragged/dropped item?