WPF 将TreeView节点信息拖拽到TextBox显示,但是TextBox不能作为拖放目标

查找好多资料说用PreviewDrop和PreviewDragOver,PreviewDragOver能进入,但是PreviewDrop不能触发!

 private void _value_PreviewDrop(object sender, DragEventArgs e)
        {
            MessageBox.Show("OK");
            TreeViewItem item = e.OriginalSource as TreeViewItem;
            string s = string.Empty;
            JsonHeaderLogic c = item.DataContext as JsonHeaderLogic;
        }

        private void _value_PreviewDragOver(object sender, DragEventArgs e)
        {
            e.Effects = DragDropEffects.Copy;
            e.Handled = true;
        }

1个回答

知道了!!!
private void _value_PreviewDragOver(object sender, DragEventArgs e)
{
e.Effects = DragDropEffects.Copy;/****/改为.Move****
e.Handled = true;
}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐