I am trying to convert a bit of code from the old RadDragAndDropManager to the new DragDropManager but the documentation is really lacking and I'm having a lot of trouble figuring out what to do.
I just have a simple function that determines whether or not the user can drop a node in a RadTreeView. I feel like this should be simple to replicate with DragDropManager, but I'm just missing something:
I just have a simple function that determines whether or not the user can drop a node in a RadTreeView. I feel like this should be simple to replicate with DragDropManager, but I'm just missing something:
Tree.AddHandler(RadDragAndDropManager.DragQueryEvent,
new
EventHandler<DragDropQueryEventArgs>(Tree_DragQuery),
true
);
private
void
Tree_DragQuery(
object
sender, DragDropQueryEventArgs e)
{
var targetTvi = e.Options.Destination
as
RadTreeViewItem;
var sourceTvi = e.Options.Source
as
RadTreeViewItem;
if
(targetTvi ==
null
|| sourceTvi ==
null
)
{
return
;
}
if
(sourceTvi.DataContext
is
LayerTviVM && targetTvi.DataContext
is
LayerTviVM)
{
e.QueryResult =
true
;
}
else
if
(sourceTvi.DataContext
is
ImageTviVM && targetTvi.DataContext
is
ImageTviVM)
{
// We only support drag & drop of images within the same layer
e.QueryResult = (sourceTvi.ParentItem == targetTvi.ParentItem);
}
else
{
e.QueryResult =
false
;
}
}