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

[Solved] RadDragAndDropManager.AddDropQueryHandler(tree, OnDropInsideTreeViewQuery)

2 Answers 78 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tim
Top achievements
Rank 1
Tim asked on 15 Dec 2009, 09:40 PM
I am trying to use this example: http://www.telerik.com/help/silverlight/radtreeview-how-to-enabled-drop-inside-only.html, but the OnDropInsideTreeViewQuery never gets called.  I am using the Q3_2009_1208 (SP1) release.

I have a breakpoint to confirm the RadDragAndDropManager.AddDropQueryHandler(tree, handler) gets called, but the breakpoint in handler is never hit.

I would expect this small example to work, based on the help document.

Tim

<UserControl x:Class="SilverlightApplication10.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"  
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
  <Grid x:Name="LayoutRoot"
        <Controls:RadTreeView  
            IsVirtualizing="True" 
            Grid.Row="0" Grid.Column="0"  
            x:Name="SelectionTree"  
            SelectionMode="Single" 
            IsDragDropEnabled="True"
        </Controls:RadTreeView> 
    </Grid> 
</UserControl> 
 

using System.Collections.ObjectModel; 
using Telerik.Windows.Controls; 
using Telerik.Windows.Controls.DragDrop; 
using Telerik.Windows.Controls.TreeView; 
 
namespace SilverlightApplication10 
    public partial class MainPage 
    { 
        public MainPage() 
        { 
            InitializeComponent(); 
            SelectionTree.ItemsSource = new ObservableCollection<string>() {"One""Two""Three"}; 
            RadDragAndDropManager.AddDropQueryHandler(SelectionTree, OnDropInsideTreeViewQuery); 
        } 
 
        private void OnDropInsideTreeViewQuery(object sender, DragDropQueryEventArgs e) 
        { 
            RadTreeViewItem treeViewItem = e.Options.Destination as RadTreeViewItem; 
            TreeViewDragCue cue = e.Options.DragCue as TreeViewDragCue; 
 
            if (e.Options.Destination is RadTreeView || 
                (treeViewItem.Level == 0 && cue.IsDropPossible && 
                treeViewItem.DropPosition != DropPosition.Inside)) 
            { 
                e.QueryResult = false
            } 
        } 
    } 
 

2 Answers, 1 is accepted

Sort by
0
Accepted
Kiril Stanoev
Telerik team
answered on 19 Dec 2009, 09:17 AM
Hi Tim,

Indeed following the steps of this article does to enable dropping only inside. We are currently working on updating our help articles and we will make sure to fix this one as well. Meanwhile, please find attached a sample project that demonstrates how to enable dropping only inside a node. If you have any questions or comments, I'd be glad to further assist you. I have also added 500 Telerik points to your account.

Greetings,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tim
Top achievements
Rank 1
answered on 21 Dec 2009, 11:08 PM
All set, thanks!
Tags
TreeView
Asked by
Tim
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Tim
Top achievements
Rank 1
Share this question
or