Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Jan 29, 2022
2 parents 846ae11 + e530db3 commit e488256
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
assembly-versioning-scheme: Major
assembly-file-versioning-scheme: MajorMinorPatchTag
next-version: 3.0.0
next-version: 3.1.0
mode: ContinuousDeployment
branches:
master:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
An easy to use drag'n'drop framework for WPF.
</p>
<p>
Supporting .NET Framework 4.5.2+, .NET Core 3.1, .NET 5 and .NET 6 (on Windows)
Supporting .NET Framework 4.6.2+, .NET Core 3.1, .NET 5 and .NET 6 (on Windows)
</p>

<a href="https://gitter.im/punker76/gong-wpf-dragdrop">
Expand Down
29 changes: 29 additions & 0 deletions src/GongSolutions.WPF.DragDrop/DragDrop.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,35 @@ public static void SetDropTargetAdornerBrush(DependencyObject element, Brush val
element.SetValue(DropTargetAdornerBrushProperty, value);
}

/// <summary>
/// Gets or sets the pen for the DropTargetAdorner.
/// </summary>
public static readonly DependencyProperty DropTargetAdornerPenProperty
= DependencyProperty.RegisterAttached("DropTargetAdornerPen",
typeof(Pen),
typeof(DragDrop),
new PropertyMetadata((Pen)null));

/// <summary>Helper for getting <see cref="DropTargetAdornerPenProperty"/> from <paramref name="element"/>.</summary>
/// <param name="element"><see cref="DependencyObject"/> to read <see cref="DropTargetAdornerPenProperty"/> from.</param>
/// <remarks>Gets the pen for the DropTargetAdorner.</remarks>
/// <returns>DropTargetAdornerPen property value.</returns>
[AttachedPropertyBrowsableForType(typeof(UIElement))]
public static Pen GetDropTargetAdornerPen(DependencyObject element)
{
return (Pen)element.GetValue(DropTargetAdornerPenProperty);
}

/// <summary>Helper for setting <see cref="DropTargetAdornerPenProperty"/> on <paramref name="element"/>.</summary>
/// <param name="element"><see cref="DependencyObject"/> to set <see cref="DropTargetAdornerPenProperty"/> on.</param>
/// <param name="value">DropTargetAdornerPen property value.</param>
/// <remarks>Sets the pen for the DropTargetAdorner.</remarks>
[AttachedPropertyBrowsableForType(typeof(UIElement))]
public static void SetDropTargetAdornerPen(DependencyObject element, Pen value)
{
element.SetValue(DropTargetAdornerPenProperty, value);
}

/// <summary>
/// Gets or sets a context for a control. Only controls with the same context are allowed for drag or drop actions.
/// </summary>
Expand Down
16 changes: 12 additions & 4 deletions src/GongSolutions.WPF.DragDrop/DragDrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ private static void DoDragSourceMove(object sender, Func<IInputElement, Point> g

private static void DragSourceOnQueryContinueDrag(object sender, QueryContinueDragEventArgs e)
{
if (e.Action == DragAction.Cancel || e.EscapePressed || (e.KeyStates.HasFlag(DragDropKeyStates.LeftMouseButton) == false && e.KeyStates.HasFlag(DragDropKeyStates.RightMouseButton) == false))
if (e.Action == DragAction.Cancel || e.EscapePressed || (e.KeyStates.HasFlag(DragDropKeyStates.LeftMouseButton) == e.KeyStates.HasFlag(DragDropKeyStates.RightMouseButton)))
{
DragDropPreview = null;
DragDropEffectPreview = null;
Expand Down Expand Up @@ -816,10 +816,18 @@ private static void DropTargetOnDragOver(object sender, DragEventArgs e, EventTy
var adorner = DropTargetAdorner;
if (adorner != null)
{
var adornerBrush = GetDropTargetAdornerBrush(dropInfo.VisualTarget);
if (adornerBrush != null)
var adornerPen = GetDropTargetAdornerPen(dropInfo.VisualTarget);
if (adornerPen != null)
{
adorner.Pen.SetCurrentValue(Pen.BrushProperty, adornerBrush);
adorner.Pen = adornerPen;
}
else
{
var adornerBrush = GetDropTargetAdornerBrush(dropInfo.VisualTarget);
if (adornerBrush != null)
{
adorner.Pen.SetCurrentValue(Pen.BrushProperty, adornerBrush);
}
}

adorner.DropInfo = dropInfo;
Expand Down

0 comments on commit e488256

Please sign in to comment.