So I'm trying to do something a little different with my drag and drop. I have a RadTreeView control to group "Reports" into "Sets". I am only allowing "Reports" to be dragged and they can only be dropped inside a "Set". When I have a Set expanded, and I drag a Report over the Set OR any of the reports
currently in that set, I'd like the hover text to say "
Drop in Set x".
I've got this half working, using the DragDropQueryEvent. If the destination's parent is a Set, I change the destination to the set and the drop position to Inside.
This works for the first time hovering over the reports inside a set, but the next time I hover over the same objects the text becomes "
Drop After Set x". As far as I can tell, the same code is being run. The drop is occurring in the right place, but the text isn't correct.
Any insight into what's happening, or another way to get this behaviour is greatly appreciated!
Below is some simplified code of my DragDropQueryEvent
private void DragQuery_CanDrop(object sender, DragDropQueryEventArgs e)
{
var treeViewItem = e.Options.Destination as RadTreeViewItem;
if (treeViewItem != null)
{
if (treeViewItem.Item is Set )
{
if (treeViewItem.DropPosition == DropPosition.Inside) //can only drop INSIDE set
{
....
e.QueryResult = true;
}
else
{
e.QueryResult = false;
}
}
else if (treeViewItem.Item is Report)
{
if (treeViewItem.ParentItem != null && treeViewItem.ParentItem.Item is Set)
{
e.Options.Destination = treeViewItem.ParentItem;
treeViewItem.DropPosition = DropPosition.Inside;
...
e.QueryResult = true;
}
else
{
e.QueryResult = false;
}
}
else
{
e.QueryResult = false;
}
}
}