From ed9c28055f1cd76bb29a4de866a478b4f30fcb75 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Jan 2021 10:58:06 +0800 Subject: [PATCH] feature: show drop area border while dragging items in/into repositories' tree --- src/App.preference.cs | 1 + src/Helpers/TreeViewHelper.cs | 2 +- src/UI/NewPage.xaml | 128 +++++++++++++++------------- src/UI/NewPage.xaml.cs | 154 +++++++++++++++++++++------------- 4 files changed, 168 insertions(+), 117 deletions(-) diff --git a/src/App.preference.cs b/src/App.preference.cs index 798a1811..f00d297c 100644 --- a/src/App.preference.cs +++ b/src/App.preference.cs @@ -200,6 +200,7 @@ namespace SourceGit { /// public bool IsSubGroup(string parentId, string subId) { if (string.IsNullOrEmpty(parentId)) return false; + if (parentId == subId) return true; var g = FindGroup(subId); if (g == null) return false; diff --git a/src/Helpers/TreeViewHelper.cs b/src/Helpers/TreeViewHelper.cs index 605fc4f4..441286c9 100644 --- a/src/Helpers/TreeViewHelper.cs +++ b/src/Helpers/TreeViewHelper.cs @@ -254,7 +254,7 @@ namespace SourceGit.Helpers { /// /// /// - private static TreeViewItem FindTreeViewItem(DependencyObject child) { + public static TreeViewItem FindTreeViewItem(DependencyObject child) { if (child == null) return null; if (child is TreeViewItem) return child as TreeViewItem; if (child is TreeView) return null; diff --git a/src/UI/NewPage.xaml b/src/UI/NewPage.xaml index 6d1ca73c..3c443d88 100644 --- a/src/UI/NewPage.xaml +++ b/src/UI/NewPage.xaml @@ -16,7 +16,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -69,25 +69,37 @@ + + + + + + MouseMove="TreeMouseMove" + DragOver="TreeDragOver" + DragEnter="TreeDragEnter" + Drop="TreeDrop">