This is a migrated thread and some comments may be shown as answers.

Auto expand node on drag over on a RadTreeListView

4 Answers 97 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Luzius
Top achievements
Rank 1
Luzius asked on 25 Jan 2012, 08:52 AM
Hi

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

Sort by
0
Nick
Telerik team
answered on 26 Jan 2012, 02:30 PM
Hello,

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! 

Kind regards,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Luzius
Top achievements
Rank 1
answered on 26 Jan 2012, 04:56 PM
Hello Nik,

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
0
Nick
Telerik team
answered on 30 Jan 2012, 09:55 AM
Hello 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!

Greetings,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Luzius
Top achievements
Rank 1
answered on 30 Jan 2012, 02:33 PM
Hello Nik,

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.



Tags
TreeListView
Asked by
Luzius
Top achievements
Rank 1
Answers by
Nick
Telerik team
Luzius
Top achievements
Rank 1
Share this question
or