diff --git a/src/GongSolutions.WPF.DragDrop/DropInfo.cs b/src/GongSolutions.WPF.DragDrop/DropInfo.cs index 7df8c95a..881ab56d 100644 --- a/src/GongSolutions.WPF.DragDrop/DropInfo.cs +++ b/src/GongSolutions.WPF.DragDrop/DropInfo.cs @@ -179,7 +179,8 @@ public DropInfo(object sender, DragEventArgs e, [CanBeNull] DragInfo dragInfo, E this.InsertPosition |= RelativeInsertPosition.TargetItemCenter; } - //System.Diagnostics.Debug.WriteLine("==> DropInfo: pos={0}, idx={1}, Y={2}, Item={3}", this.InsertPosition, this.InsertIndex, currentYPos, item); + + // System.Diagnostics.Debug.WriteLine($"==> DropInfo: pos={this.InsertPosition}, index={this.InsertIndex}, currentXPos={currentXPos}, Item={this.item}"); } else { @@ -188,7 +189,7 @@ public DropInfo(object sender, DragEventArgs e, [CanBeNull] DragInfo dragInfo, E if (this.VisualTargetFlowDirection == FlowDirection.RightToLeft) { - if (currentXPos > targetWidth / 2) + if (currentXPos < targetWidth / 2) { this.InsertPosition = RelativeInsertPosition.BeforeTargetItem; } @@ -221,7 +222,8 @@ public DropInfo(object sender, DragEventArgs e, [CanBeNull] DragInfo dragInfo, E this.InsertPosition |= RelativeInsertPosition.TargetItemCenter; } - //System.Diagnostics.Debug.WriteLine("==> DropInfo: pos={0}, idx={1}, X={2}, Item={3}", this.InsertPosition, this.InsertIndex, currentXPos, item); + + // System.Diagnostics.Debug.WriteLine($"==> DropInfo: pos={this.InsertPosition}, index={this.InsertIndex}, currentXPos={currentXPos}, Item={this.item}"); } } else diff --git a/src/GongSolutions.WPF.DragDrop/DropTargetInsertionAdorner.cs b/src/GongSolutions.WPF.DragDrop/DropTargetInsertionAdorner.cs index 5f3c6964..7778f7fd 100644 --- a/src/GongSolutions.WPF.DragDrop/DropTargetInsertionAdorner.cs +++ b/src/GongSolutions.WPF.DragDrop/DropTargetInsertionAdorner.cs @@ -133,18 +133,7 @@ protected override void OnRender(DrawingContext drawingContext) } else { - if (dropInfo.VisualTargetFlowDirection == FlowDirection.LeftToRight && dropInfo.InsertIndex == itemsCount) - { - if (itemsCount > 0) - { - itemRect.X += itemContainer.RenderSize.Width; - } - else - { - itemRect.X += this.Pen.Thickness; - } - } - else if (dropInfo.VisualTargetFlowDirection == FlowDirection.RightToLeft && dropInfo.InsertIndex != itemsCount) + if (dropInfo.InsertIndex == itemsCount) { if (itemsCount > 0) { diff --git a/src/GongSolutions.WPF.DragDrop/Utilities/DragDropExtensions.cs b/src/GongSolutions.WPF.DragDrop/Utilities/DragDropExtensions.cs index 4aacbcef..e1b181c6 100644 --- a/src/GongSolutions.WPF.DragDrop/Utilities/DragDropExtensions.cs +++ b/src/GongSolutions.WPF.DragDrop/Utilities/DragDropExtensions.cs @@ -127,7 +127,7 @@ private static BitmapSource CaptureScreen(Visual target, FlowDirection flowDirec { var transformGroup = new TransformGroup(); transformGroup.Children.Add(new ScaleTransform(-1, 1)); - transformGroup.Children.Add(new TranslateTransform(bounds.Size.Width - 1, 0)); + transformGroup.Children.Add(new TranslateTransform(bounds.Size.Width, 0)); ctx.PushTransform(transformGroup); } diff --git a/src/Showcase/Views/ListBoxSamples.xaml b/src/Showcase/Views/ListBoxSamples.xaml index 620ddd1f..530b9a42 100644 --- a/src/Showcase/Views/ListBoxSamples.xaml +++ b/src/Showcase/Views/ListBoxSamples.xaml @@ -123,11 +123,36 @@ - + + + + + + ListBoxItem1 + ListBoxItem2 + ListBoxItem3 + ListBoxItem4 + ListBoxItem5 + + +