Hi there,
I am trying to get drag and drop within a radtreeview to work for the following scenario without much luck after following a recent example posted in this forum.
* Two level hierarchy: A list of Teams containing Player objects.
* Teams and Players can be dragged.
* Teams can only be dropped before or after Team objects
* Players can be dropped inside a Team
* Players can be rearranged within a Team
* Players cannot be dropped inside of other Players
I managed to get some of the above working, however an issue I ran into is this. I could not stop a Player being placed at the same level as a Team object, when that Player is dragged right at the bottom of the treeview.
How do I prevent Player objects from being dragged to the root level?
This is what I have:
I am trying to get drag and drop within a radtreeview to work for the following scenario without much luck after following a recent example posted in this forum.
* Two level hierarchy: A list of Teams containing Player objects.
* Teams and Players can be dragged.
* Teams can only be dropped before or after Team objects
* Players can be dropped inside a Team
* Players can be rearranged within a Team
* Players cannot be dropped inside of other Players
I managed to get some of the above working, however an issue I ran into is this. I could not stop a Player being placed at the same level as a Team object, when that Player is dragged right at the bottom of the treeview.
How do I prevent Player objects from being dragged to the root level?
This is what I have:
private
void
OnDropInsideTreeViewDropQuery(
object
sender, DragDropQueryEventArgs e)
{
var destination = e.Options.Destination
as
RadTreeViewItem;
if
(destination !=
null
&& e.Options.Status == DragStatus.DropDestinationQuery)
if
(destination.DropPosition == DropPosition.Inside)
{
Console.WriteLine(
"Inside"
);
Team t= destination.Item
as
Team;
if
(t !=
null
)
{
object
item = (e.Options.Payload
as
Collection<Object>)[0];
if
(item.GetType().Name ==
"Team"
)
{
e.QueryResult =
false
;
}
}
}
else
{
object
item = (e.Options.Payload
as
Collection<Object>)[0];
Team t = destination.Item
as
Team;
if
(t!=
null
)
{
if
(item.GetType().Name ==
"Player"
)
{
e.QueryResult =
false
;
}
}
else
{
//
}
- How can I prevent the Player being dragged to the same level as the Team objects?