0

I was searching for possible solution for hours and could not find any. Hopefully someone can help me.

I managed to implement Multi Select WPF TreeView using the following answer: https://stackoverflow.com/a/6681993/1679059

It works nicely but I want to be able to drag selected items and drop them into the DataGrid. In PreviewMouseMove event handler previously selected items get deselected so I can't prevent that from happening.

I was trying to prevent deselecting items in PreviewMouseLeftButtonDown event handler but at that point I cannot know if a user intends to select an item or drag selected items.

Can someone help me with that problem?

Community
  • 1
  • 1
user1679059
  • 41
  • 1
  • 6

1 Answers1

-2

you can do this by adding a bool variable let say 'isLeftClick' in MouseLeftButton Event change isLeftClick to 'TRUE' and in MouseMove event check if isLeftClick is true or false if it is true then user thn user is trying to drag. also check if mouse is pointed on one of selected nodes thn drag those nodes if it is on some unselected node then select that node and drag it.

Awais
  • 1