Drag multiple items from WPF listview

前端 未结 3 969
闹比i
闹比i 2021-01-20 18:15

I have a listview that displays files from a directory.
The user can drag each item in the listview to a folder/ the desktop and the associated file is copied there.

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-20 18:25

    I'd like to point out an small error in the code

        Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance &&
        Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)
    

    should be

        Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance ||
        Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)
    

    Otherwise a straight Horizontal or Vertical will do nothing. Chances of that happening are small, but still..

提交回复
热议问题