I'm having some problems dragging a WinForms TreeNode
to a WPF ListBox
.
I set the ListBox.AllowDrop = true
and subscribe the DragEnter
and Drop
events. The events are raised when they should but I think the Args are a bit messed up.
I'm trying to filter the objects that can be dropped into this specific target. I just started by trying to disallow every object by setting the DragDropEffects = DragDropEffects.None
but it just isn't working.
Is this a question of interoperability between WinForms and WPF or am I doing something wrong?
Here is the XAML for the Listbox:
<ListBox Name="itmCtrlSetupSteps" Grid.Row="1"
BorderThickness="2" BorderBrush="{Binding DropBrush}" Background="Transparent"
ItemsSource="{Binding SetupSteps}" SelectionMode="Single" ItemContainerStyle="{StaticResource StepItemStyle}"
HorizontalContentAlignment="Stretch"
SelectionChanged="manageStep_SelectionChanged"
AllowDrop="True" DragEnter="itmCtrls_DragEnter" Drop="itmCtrls_Drop"
/>
And here is the code for the DragEnter event handler:
private void itmCtrls_DragEnter(object sender, DragEventArgs e)
{
e.Effects = DragDropEffects.None;
e.Handled = true;
}