2 Commits 0f794800c9 ... 2ab86ca67f

Auteur SHA1 Bericht Datum
  lintx 2ab86ca67f 添加 ItemsDraggable 附加属性, 拖拽 ItemsControl 子元素以变更顺序或移动其它集合 6 maanden geleden
  lintx 0f794800c9 添加 ItemsDraggable 附加属性, 拖拽 ItemsControl 子元素以变更顺序或移动其它集合 6 maanden geleden
1 gewijzigde bestanden met toevoegingen van 7 en 8 verwijderingen
  1. 7 8
      Waaagh/Behaviors/ItemsDraggable.cs

+ 7 - 8
Waaagh/Behaviors/ItemsDraggable.cs

@@ -45,16 +45,16 @@ namespace Waaagh.Behaviors {
 
 
 
-        public static Func<object, Type, IList?> GetTryGetSubCollection(DependencyObject obj) {
-            return (Func<object, Type, IList?>)obj.GetValue(TryGetSubCollectionProperty);
+        public static Func<object, Type, IList?> GetQueryTargetCollection(DependencyObject obj) {
+            return (Func<object, Type, IList?>)obj.GetValue(QueryTargetCollectionProperty);
         }
 
-        public static void SetTryGetSubCollection(DependencyObject obj, Func<object, Type, IList?> value) {
-            obj.SetValue(TryGetSubCollectionProperty, value);
+        public static void SetQueryTargetCollection(DependencyObject obj, Func<object, Type, IList?> value) {
+            obj.SetValue(QueryTargetCollectionProperty, value);
         }
 
-        public static readonly DependencyProperty TryGetSubCollectionProperty =
-            DependencyProperty.RegisterAttached("TryGetSubCollection", typeof(Func<object, Type, IList?>), typeof(ItemsDraggable), new PropertyMetadata(null));
+        public static readonly DependencyProperty QueryTargetCollectionProperty =
+            DependencyProperty.RegisterAttached("QueryTargetCollection", typeof(Func<object, Type, IList?>), typeof(ItemsDraggable), new PropertyMetadata(null));
 
 
         #endregion
@@ -114,7 +114,7 @@ namespace Waaagh.Behaviors {
             // 判断 集合元素类型
             object? targetData = targetControl.DataContext;
             if (CheckCollectionElementType(sourceCollection, targetCollection) == false) {
-                IList? collection = GetTryGetSubCollection(targetItemsControl)?.Invoke(targetControl.DataContext, sourceData.GetType());
+                IList? collection = GetQueryTargetCollection(targetItemsControl)?.Invoke(targetControl.DataContext, sourceData.GetType());
                 if (collection == null || CheckCollectionElementType(sourceCollection, collection) == false) {
                     return;
                 }
@@ -191,7 +191,6 @@ namespace Waaagh.Behaviors {
                         position.Y < 0 || position.Y > control.ActualHeight) {
                         continue;
                     }
-                    // 鼠标在控件内
                     if (control is ContentControl) {
                         child = control;
                         return true;