|
1 | 1 | namespace NumericUpDownLib.Base
|
2 | 2 | {
|
| 3 | + using NumericUpDownLib.Enums; |
3 | 4 | using NumericUpDownLib.Models;
|
4 | 5 | using System;
|
5 | 6 | using System.Windows;
|
@@ -165,6 +166,13 @@ public abstract partial class AbstractBaseUpDown<T> : InputBaseUpDown
|
165 | 166 | DependencyProperty.Register("IsMouseDragEnabled", typeof(bool),
|
166 | 167 | typeof(AbstractBaseUpDown<T>), new PropertyMetadata(true, OnIsMouseDragEnabledChanged));
|
167 | 168 |
|
| 169 | + /// <summary> |
| 170 | + /// Backing store of <see cref="CanIncDecMouseDrag"/> dependency property. |
| 171 | + /// </summary> |
| 172 | + public static readonly DependencyProperty CanMouseDragProperty = |
| 173 | + DependencyProperty.Register("CanMouseDrag", typeof(CanIncDecMouseDrag), |
| 174 | + typeof(AbstractBaseUpDown<T>), new PropertyMetadata(CanIncDecMouseDrag.VerticalHorizontal)); |
| 175 | + |
168 | 176 | /// <summary>
|
169 | 177 | /// Holds the REQUIRED textbox instance part for this control.
|
170 | 178 | /// </summary>
|
@@ -353,6 +361,18 @@ public bool IsMouseDragEnabled
|
353 | 361 | set { SetValue(IsMouseDragEnabledProperty, value); }
|
354 | 362 | }
|
355 | 363 |
|
| 364 | + /// <summary> |
| 365 | + /// Gets/sets wether small/large step sizes can be incremented/decremented |
| 366 | + /// both with vertical/horizontal mouse drag moves or, |
| 367 | + /// whether only horizontal or only vertical mouse drag moves can |
| 368 | + /// incremented/decremented only in small or only in large values. |
| 369 | + /// </summary> |
| 370 | + public CanIncDecMouseDrag CanMouseDrag |
| 371 | + { |
| 372 | + get { return (CanIncDecMouseDrag)GetValue(CanMouseDragProperty); } |
| 373 | + set { SetValue(CanMouseDragProperty, value); } |
| 374 | + } |
| 375 | + |
356 | 376 | /// <summary>
|
357 | 377 | /// Determines whether last text input was from a user (key was down) or not.
|
358 | 378 | /// </summary>
|
@@ -594,8 +614,8 @@ private void _PART_TextBox_MouseMove(object sender, MouseEventArgs e)
|
594 | 614 | }
|
595 | 615 |
|
596 | 616 | var pos = GetPositionFromThis(e);
|
597 |
| - double deltaX = _objMouseIncr.Point.X - pos.X; |
598 |
| - double deltaY = _objMouseIncr.Point.Y - pos.Y; |
| 617 | + double deltaX = (CanMouseDrag == CanIncDecMouseDrag.VerticalOnly ? 0 : _objMouseIncr.Point.X - pos.X); |
| 618 | + double deltaY = (CanMouseDrag == CanIncDecMouseDrag.HorizontalOnly ? 0 : _objMouseIncr.Point.Y - pos.Y); |
599 | 619 |
|
600 | 620 | if (_objMouseIncr.MouseDirection == MouseDirections.None)
|
601 | 621 | {
|
|
0 commit comments