This question is locked. New answers and comments are not allowed.
I drag an object from RadGridView to a RadTreeViewItem which includes dynamic items. It worked with 2011Q2 and SL4. Now it update to 2011Q3 and SL5. Then e.Options.Destination property always returns root item. And use the old version I can write "telerik:RadDragAndDropManager.AllowDrop="True"" in xaml file and it work. But now I must set RadDragAndDropManager.SetAllowDrop(d, true) in c# code.
<Grid x:Name="LayoutRoot" Background="White"> <telerik:RadTreeView> <telerik:RadTreeViewItem>... </telerik:RadTreeViewItem> <telerik:RadTreeViewItem Header="" ItemsSource="{Binding RootMailFolders,Mode=OneWay}" core:MailFolderDragAndDropManager.DropCommand="{Binding MoveMailToFolderCommand}" telerik:RadDragAndDropManager.AllowDrag="False" telerik:RadDragAndDropManager.AllowDrop="True"> <telerik:RadContextMenu.ContextMenu> ... </telerik:RadContextMenu.ContextMenu> <telerik:RadTreeViewItem.ItemTemplate> <telerik:HierarchicalDataTemplate ItemsSource="{Binding Converter={StaticResource MailFolderConverter}, ConverterParameter={StaticResource ViewModelProxy}}"> <telerik:ContainerBinding.ContainerBindings> <telerik:ContainerBindingCollection> <telerik:ContainerBinding PropertyName="Command" Binding="{Binding DataContext.OpenMailFolderCommand, ElementName=LayoutRoot}" /> <telerik:ContainerBinding PropertyName="CommandParameter" Binding="{Binding}" /> </telerik:ContainerBindingCollection> </telerik:ContainerBinding.ContainerBindings> <StackPanel Orientation="Horizontal"> <Image Margin="0,0,5,0"/> <TextBlock Text="{Binding FolderName,Mode=OneWay}" /> </StackPanel> </telerik:HierarchicalDataTemplate> </telerik:RadTreeViewItem.ItemTemplate> </telerik:RadTreeViewItem> </telerik:RadTreeView>public class MailFolderDragAndDropManager { public static readonly DependencyProperty DropCommandProperty = DependencyProperty.RegisterAttached("DropCommand", typeof(ICommand), typeof(MailFolderDragAndDropManager), new PropertyMetadata(null, OnDropCommandChanged)); public static ICommand GetDropCommand(DependencyObject obj) { return (ICommand)obj.GetValue(DropCommandProperty); } public static void SetDropCommand(DependencyObject obj, ICommand value) { obj.SetValue(DropCommandProperty, value); } private static void OnDropCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue != null) { RadDragAndDropManager.SetAllowDrop(d, true); RadDragAndDropManager.SetAllowDrag(d, true); RadDragAndDropManager.AddDragQueryHandler(d, OnDragQuery); RadDragAndDropManager.AddDropQueryHandler(d, OnDropQuery); RadDragAndDropManager.AddDropInfoHandler(d, OnDropInfo); } else { RadDragAndDropManager.SetAllowDrop(d, false); RadDragAndDropManager.SetAllowDrag(d, false); RadDragAndDropManager.RemoveDragQueryHandler(d, OnDragQuery); RadDragAndDropManager.RemoveDropQueryHandler(d, OnDropQuery); RadDragAndDropManager.RemoveDropInfoHandler(d, OnDropInfo); } } private static void OnDragQuery(object sender, DragDropQueryEventArgs e) { if (e.Options.Status == DragStatus.DragQuery) { if (e.Options.Source.DataContext != null && e.Options.Source.DataContext is MailHeaderDto) { e.Options.Payload = e.Options.Source.DataContext; e.Options.ArrowCue = RadDragAndDropManager.GenerateArrowCue(); ContentControl cue = new ContentControl(); cue.Content = ((MailHeaderDto)e.Options.Source.DataContext).Subject; e.Options.DragCue = cue; } } e.QueryResult = e.Options.Payload != null; e.Handled = true; } private static void OnDropQuery(object sender, DragDropQueryEventArgs e) { if (e.Options.Status == DragStatus.DropDestinationQuery) { e.QueryResult = e.Options.Source != e.Options.Destination; } e.Handled = true; } private static void OnDropInfo(object sender, DragDropEventArgs e) { if (e.Options.Status == DragStatus.DropComplete) { ...//e.Options.Destination always return rootitem } e.Handled = true; } }