Pointer snapping only while Dragging (Interacting)

Gauge for WPF Forum

Posted 4 years ago by Tom P.
Version: 19.1.0684
Avatar

Our users would like to be able to have Pointer snapping enabled when dragging, but if they type a number, they want the Pointer to display the typed number (and not snap).

I cannot seem to get this to work without writing PreviewLeftMouseButtonDown/Up Event handlers. My handlers simply change the value of IsSnappingEnabled: true for Down, false for Up. This mostly works, but, the Value does not snap until I move the mouse sufficiently.  I would like the Value to snap immediately when IsSnappingEnabled is set to true. I could do the calculations myself base on my SnappingInterval, but the CalculateValue() methods are protected, and doing that math on my own could miss something.

I guess what I want is a SnappingMode. While Dragging, ValueChanged, Both.

Comments (4)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tom,

Hmmm, I would think that your PreviewLeftMouseButtonDown/Up trick would work since I believe when you change IsSnappingEnabled, it immediately snaps the value.

In terms of updating logic to have an option to only snap when dragging, that should be doable.  But I'm wondering if you want snapping enabled, is there ever a scenario someone would want it to NOT happen when dragging, but to happen when changing value only?  I'm not sure that scenario would ever occur.  It seems like if you're snapping, you'd always want it on, or only while dragging, no?


Actipro Software Support

Posted 4 years ago by Tom P.
Avatar

Hmmm, I would think that your PreviewLeftMouseButtonDown/Up trick would work since I believe when you change IsSnappingEnabled, it immediately snaps the value.

It works, but I had to do this as well for some reason

            pointer.IsSnappingEnabled = true;

            // We have to trick the pointer into re-calculating the Value for reasons I don't understand.
            var saveValue = pointer.Value;
            pointer.IsValueChangedEventRaised = false;
            pointer.IsValueChangedEventRaised = true;
            pointer.Value = saveValue;
       

But I'm wondering if you want snapping enabled, is there ever a scenario someone would want it to NOT happen when dragging, but to happen when changing value only?  I'm not sure that scenario would ever occur.  It seems like if you're snapping, you'd always want it on, or only while dragging, no?

I asked about this as well. We have a legacy MFC implementation of this that behaves as I described, and I must reproduce this behavior exactly :(.

In terms of updating logic to have an option to only snap when dragging, that should be doable.

That would be great, if you do implement this, I look forward to it. I have another thread about how dragging clamps to the min/max if you want to dig into that also ;)

Thanks for your usual excellent support!

Answer - Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tom,

Ok, we'll add a SnappingMode in the 2020.1 version for you.


Actipro Software Support

Posted 4 years ago by Tom P.
Avatar

Best support team ever. Thanks!

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.