dogdeser
2017-11-06 11:03
采纳率: 0%
浏览 1.7k

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条回答 默认 最新

  • dogdeser 2017-11-06 11:06

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

    打赏 评论

相关推荐 更多相似问题