This question is locked. New answers and comments are not allowed.
I'm trying to handle the DropQuery event so that I can "disable" dropping Before or After a node ... I only want drop In.
I have this XAML
and this in my code behind
I set a breakpoint on my UnitTree_DropQuery event handler and it never gets fired. I am definitely able to drag and drop items in my tree. I get the preview for drag before, drag in and drag after. Any ideas on what I'm doing wrong?
Thanks for your help.
I have this XAML
<telerik:RadTreeView x:Name="UnitTree" Grid.Row="3" ItemsSource="{Binding UnitsList, NotifyOnValidationError=True, Converter={StaticResource UnitCollectionConverter}}" IsExpandOnDblClickEnabled="True" SelectedItem="{Binding SelectedUnit, Mode=TwoWay}" ScrollViewer.VerticalScrollBarVisibility="Auto" BorderBrush="Black" BorderThickness="1" Margin="5" AllowDrop="True" IsDragDropEnabled="True" IsDragPreviewEnabled="True" IsDropPreviewLineEnabled="False"> <telerik:RadTreeView.ItemTemplate > <telerik:HierarchicalDataTemplate ItemsSource="{Binding NotifyOnValidationError=True, Converter={StaticResource UnitCollectionConverter}}"> <StackPanel Orientation="Vertical" Margin="5"> <StackPanel Orientation="Horizontal"> <TextBlock TextWrapping="Wrap" Text="{Binding Name, NotifyOnValidationError=True}" FontWeight="Bold" VerticalAlignment="Center" Width="185"/> <TextBlock TextWrapping="Wrap" Text="*" FontWeight="Bold" FontSize="18" VerticalAlignment="Center" Foreground="{Binding HasValidationErrors, Converter={StaticResource EntityErrorsToColorBrush}}" Visibility="{Binding EntityState, Converter={StaticResource EntityStateToVisibility}}"/> </StackPanel> <TextBlock Text="{Binding UnitType}" FontStyle="Italic" FontSize="10" Foreground="Gray" FontWeight="Bold" /> </StackPanel> </telerik:HierarchicalDataTemplate> </telerik:RadTreeView.ItemTemplate> </telerik:RadTreeView>and this in my code behind
public partial class EntityNavigator : UserControl { public EntityNavigator() { InitializeComponent(); UnitTree.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(UnitTree_DropQuery)); } private void UnitTree_DropQuery(object sender, DragDropQueryEventArgs e) { //Enabled following line just to force a crash to see if breakpoint wasn't working for some reason //var myitem = UnitTree.Items[253]; var item = e.Options.Destination as RadTreeViewItem; if (item.DropPosition != DropPosition.Inside) e.QueryResult = false; }}I set a breakpoint on my UnitTree_DropQuery event handler and it never gets fired. I am definitely able to drag and drop items in my tree. I get the preview for drag before, drag in and drag after. Any ideas on what I'm doing wrong?
Thanks for your help.