My event handlers do not get activated after moving to DragDropManager -- what to do?

2 posts, 0 answers
  1. Anders
    Anders avatar
    80 posts
    Member since:
    Dec 2010

    Posted 18 Jun 2013 Link to this post

    Hi telerik,

    I'm trying to make the move from 'old school' d'n'd to the new based on latest release. I've tried to follow you example in documentation.
    However, no events are activated. The dragged item is moved to new location, completely handled by the treeview (and none of my code discovers it).

    Any suggestions on what to do?

    Thanks,

    Anders

    xaml:
    <Controls:RadTreeView
               ItemsSource="{Binding Path=WorkspaceViewModel.Children, NotifyOnSourceUpdated=True}"
               Name="treeview"
               IsLineEnabled="True"
               MouseRightButtonDown="TreeviewMouseRightButtonDown"
               IsDragDropEnabled="True"
               SelectionMode="Single"
               MouseLeftButtonDown="TreeviewMouseLeftButtonDown"
               IsEditable="{Binding CommandHandlerViewModel.CanEditSelected}"
               ItemEditTemplate="{StaticResource edittemplate}"
               >
                
               <Controls:RadTreeView.Resources>
                   <Style TargetType="Controls:RadTreeView">
                       <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True"></Setter>
                   </Style>
               </Controls:RadTreeView.Resources>


    In the constructor of the usercontrol, holding the treeview:

    DragDropManager.AddDragInitializeHandler(treeview, OnDragInitialize);
     
    DragDropManager.AddGiveFeedbackHandler(treeview, OnGiveFeedback1);
     
    DragDropManager.AddDragDropCompletedHandler(treeview, OnDragCompleted1);
     
    DragDropManager.AddDropHandler(treeview, OnDrop1);

    None of them are implemented yet -- I'm expecting an exception:
    private void OnDragCompleted1(object sender, DragDropCompletedEventArgs e)
    {
        throw new NotImplementedException();
    }
     
    private void OnDrop1(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
    {
        throw new NotImplementedException();
    }
     
    private void OnGiveFeedback1(object sender, GiveFeedbackEventArgs e)
    {
        throw new NotImplementedException();
    }
     
    private void OnDragInitialize(object sender, DragInitializeEventArgs e)
    {
        throw new NotImplementedException();
    }
  2. Anders
    Anders avatar
    80 posts
    Member since:
    Dec 2010

    Posted 18 Jun 2013 Link to this post

    I found out.
    ,true
    is needed when registering the event handlers...
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top