-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
milleniumbug
committed
Feb 13, 2017
1 parent
b026b8a
commit ce1d892
Showing
2 changed files
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,10 +101,15 @@ private void OpenTaxonomyClick(object sender, RoutedEventArgs e) | |
} | ||
|
||
private Point? tagClickStartPoint; | ||
private FrameworkElement draggedItem; | ||
|
||
private void TagPreviewLeftButtonDown(object sender, MouseButtonEventArgs e) | ||
{ | ||
tagClickStartPoint = e.GetPosition(null); | ||
// Get the dragged item | ||
var treeView = (TreeView)sender; | ||
draggedItem = | ||
FindAnchestor<TextBlock>((DependencyObject)e.OriginalSource); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
milleniumbug
Owner
|
||
} | ||
|
||
private void TagPreviewMouseMove(object sender, MouseEventArgs e) | ||
|
@@ -119,20 +124,15 @@ private void TagPreviewMouseMove(object sender, MouseEventArgs e) | |
Math.Abs(distance.X) > SystemParameters.MinimumHorizontalDragDistance && | ||
Math.Abs(distance.Y) > SystemParameters.MinimumVerticalDragDistance) | ||
{ | ||
// Get the dragged ListViewItem | ||
var treeView = (TreeView)sender; | ||
var item = | ||
FindAnchestor<TextBlock>((DependencyObject)e.OriginalSource); | ||
|
||
// Find the data behind the ListViewItem | ||
var tag = item?.DataContext as Tag; | ||
var tag = draggedItem?.DataContext as Tag; | ||
|
||
if(tag == null) | ||
return; | ||
|
||
// Initialize the drag & drop operation | ||
var dragData = new DataObject(typeof(Tag), tag); | ||
DragDrop.DoDragDrop(item, dragData, DragDropEffects.Move); | ||
DragDrop.DoDragDrop(draggedItem, dragData, DragDropEffects.Move); | ||
|
||
tagClickStartPoint = null; | ||
} | ||
|
s/FindAnchestor/FindAncestor typo