Drag and Drop events in TreeListView

2 posts, 0 answers
  1. Max
    Max avatar
    7 posts
    Member since:
    Dec 2010

    Posted 22 May 2013 Link to this post

    Hi,

    I'm trying to add drag and drop behavior to RadTreeListView like this:
            <Style TargetType="telerik:RadTreeViewItem" x:Key="TreeViewItemStyle">
                <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
                <Setter Property="telerik:DragDropManager.AllowDrag" Value="True"/>
                <Setter Property="telerik:RadDragAndDropManager.AllowDrop" Value="True" />
            </Style>
    ....
     <telerik:RadTreeListView  x:Name="TestScriptTreeListView"
    SelectedItem="{Binding TestViewItem.SelectedScriptActionViewItem, Mode=TwoWay}"  
    ItemContainerStyle="{StaticResource TreeViewItemStyle}"
    IsDragDropEnabled="True"
    AllowDrop="True"
    ItemsSource="{Binding Source={StaticResource scriptActionSorted}}"
    behavior:TestScriptDragDropBehavior.UseTestScriptDragDrop="True"">

    and in the behavior I tried to register to the events like this:
    private static void StartUseDragDrop(RadTreeListView treeListView)
        {
          DragDropManager.AddDragInitializeHandler(treeListView, OnDragInitialize);
          DragDropManager.AddGiveFeedbackHandler(treeListView, OnGiveFeedback);
          DragDropManager.AddDropHandler(treeListView, OnDrop);
          DragDropManager.AddDragDropCompletedHandler(treeListView, OnDragDropCompleted);
          DragDropManager.AddDragOverHandler(treeListView, OnDragOver);
          //this is just to try and stop
          DragDropManager.AddPreviewDragEnterHandler(treeListView, DragEnter2);
          DragDropManager.AddPreviewDragOverHandler(treeListView, OnDragOver2);
          DragDropManager.AddPreviewDropHandler(treeListView, OnDrop2);
          DragDropManager.AddPreviewGiveFeedbackHandler(treeListView, OnGiveFeedback2);*/
           
        }

    the problem is that the only events that are called are the preview events and no the actual regular events. The only event that is called is the "OnDragDropCompleted" event. how can i make it call the regular events also?


  2. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 24 May 2013 Link to this post

    Hello Max,

    From the provided code snippets I have noticed that you are using our RadTreeListView. I believe the problem is that your style is targeting RadTreeView.

    Regards,
    Yoan
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top