The RadTreeView offers the ability to automatically expand when dragging items over a node. How do I achieve this on a RadTreeListView. Is there a sample out there?
Thanks,
Luzius
4 Answers, 1 is accepted
By design the TreeList does not provide this functionality. You can however implement the functionality quite easily using The DragDropManager. You can use the DragOver event to expand the desired row. You can read more about the DragDropManager here.
Mind however that the DragDrop operation must not depend on the source UI element. It should rather rely on the underlying item. The reason this is required is that when a row is expanded, the whole TreeList is refreshed. Therefore, there is no way to be sure that the source UI item is the actual one, since the TreeList reuses its rows when its refreshed.
Hope this helps!
Nik
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I'm using the RadDragAndDropManager which doesn't implement a DragOver event. Do I have to change my implementation or is there a way using the RadDragAndDropManager?
Thanks,
Luzius
You can use the equivalent event in the RadDragAndDropManager. The DropQuery event with status DropDestinationQuery, gives you the same functionality as the DragOver event.
Hope this helps!
Nik
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I implemented it using a timer class derived from DispatcherTimer.
At the DropInfoHandler I inserted the following code.
if
(row.IsExpandable && !row.IsExpanded)
{
if
(_ExpNodeTimer.row != row)
{
_ExpNodeTimer.Stop();
_ExpNodeTimer.row = row;
_ExpNodeTimer.Start();
}
}
else
_ExpNodeTimer.Stop();
At the timer tick handler I call the Expand function of my timer class to expand the row.
void
ExpNodeTimer_Tick(
object
sender, EventArgs e)
{
((DelaydExpNodeDspTmr)sender).Stop();
if
(RadDragAndDropManager.IsDragging)
((DelaydExpNodeDspTmr)sender).Expand();
}
I'm not quite sure if this is a good practice but it works for me so far.