TreeViewDragCue via DragDropManager.

10 posts, 0 answers
  1. Pavel
    Pavel avatar
    10 posts
    Member since:
    Feb 2013

    Posted 02 Apr 2013 Link to this post

    I'm dragging item from TreeView to TreeListView and want to update TreeViewDragCue dynamicly to set its' IsDropPossible property. 
    How can I get an object of it?
    Thanks,
    Pavel.
  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 02 Apr 2013 Link to this post

    Hi Pavel,

    You can save a reference to the Visual in the DragInitialize event and use it later on for the Drag operation.

    Hope this helps! 

    Regards,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Pavel
    Pavel avatar
    10 posts
    Member since:
    Feb 2013

    Posted 02 Apr 2013 Link to this post

    But where can I get it? DragVisual is null. 
    Thanks,
    Pavel.
  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 05 Apr 2013 Link to this post

    Hello Pavel,

    When using our DragDropManager you can subscribe to the DragInitialize event. In its event handler you are allowed to set a DataTemplate (defined in your XAML) to the e.DragVisual property. When setting it you can save a reference to it like this:

    private var myDragVisual;
    private void OnDragInitialize(object sender, DragInitializeEventArgs
    {
        ...
        myDragVisual = new ContentControl { ContentTemplate = this.Resources["MyDragCueTemplate"] as DataTemplate };
        e.DragVisual = myDragvisual;
        ...
    }
    By doing so you will be able to modify your visual later on.

    For more information you can refer to our documentation or our online demonstration project.

    Regards,
    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Pavel
    Pavel avatar
    10 posts
    Member since:
    Feb 2013

    Posted 09 Apr 2013 Link to this post

    Ok, you right, but I asked about how can I get Cue that automaticly setted by treelistview? 
    Exactly that cue that named as "TreeListViewDragCue" and placed in Telerik.Windows.Controls namespace.
    Did you read it? 
    Thanks, 
    Pavel.
  7. Nick
    Admin
    Nick avatar
    593 posts

    Posted 10 Apr 2013 Link to this post

    Hi Pavel,

    Do you get null values for the DragVisual when you start the drag from both TreeList and TreeView? 

    Looking forward to hearing from you! 

    All the best,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Pavel
    Pavel avatar
    10 posts
    Member since:
    Feb 2013

    Posted 10 Apr 2013 Link to this post

    Hello Nik,
    I got null in both cases in both controls. 
    Even I do reordering in TreeListView. Visual feedback from drag'n'drop is presented, but still null in DragVisual. 
    Thanks, 
    Pavel.
  9. Nick
    Admin
    Nick avatar
    593 posts

    Posted 11 Apr 2013 Link to this post

    Hello Pavel,

    I tested your scenario locally and get the same behavior. May I ask you to subscribe to the DragSterted events and see if you get null value there too? 

    Looking forward to hearing from you! 

    Kind regards,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  10. Pavel
    Pavel avatar
    10 posts
    Member since:
    Feb 2013

    Posted 15 Apr 2013 Link to this post

    I have no idea where can I find this event. 
    I use DragDropManager.
    Thanks,
    Pavel.
  11. Nick
    Admin
    Nick avatar
    593 posts

    Posted 17 Apr 2013 Link to this post

    Hi Pavel,

    Unfortunately it turns out you cannot get the cue at the moment. We are going to investigate further and provide a fix as soon as possible. 

    As to updating states of the TreeListViewDragCue, we have fixed the problem regarding the cue not updating its states according to the drag effects, so now you can just set the DragEffects to none, for example, and the cue will reflect that change with the drop not allowed sign. The fix will be available with our next internal build.

    Hope this helps! 

    Regards,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner