punker76/gong-wpf-dragdrop

Drop to TextBox no longer working

cts-craig opened this issue · 1 comments

I have upgraded from v0.1.3.0 to v0.1.3.11 and I can not drag from a listbox to a textbox. Without changing any code or XAML, if I switch back to the older version, this works again.

Here is my XAML:

        <ListBox ItemsSource="{Binding Names}" Grid.Column="0"
                 dragDrop:DragDrop.IsDragSource="True"></ListBox>
        <TextBox Text="{Binding Name,Mode=OneWay}" IsReadOnly ="True"  Grid.Column="1" Height="30" 
                 dragDrop:DragDrop.IsDropTarget="True"
                 dragDrop:DragDrop.DropHandler="{Binding MyDropHandler}" />

Here is my DropHandler:

    public class MyDropHandler : IDropTarget
    {
        private readonly MainWindowViewModel _mainWindowViewModel;

        public MyDropHandler(MainWindowViewModel mainWindowViewModel)
        {
            _mainWindowViewModel = mainWindowViewModel;
        }

        public void DragOver(IDropInfo dropInfo)
        {
            dropInfo.Effects = DragDropEffects.Copy;
        }

        public void Drop(IDropInfo dropInfo)
        {
            _mainWindowViewModel.Name = (string) dropInfo.Data;
        }
    }

I am going to start looking through the code changes for the DD library to see if can see what change might have affected this.

Thanks for the fast response, works great!