Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

cursor snaps to invisible plots (wpf controls)

Hi all

 

I saw that the Snappable property has been added to XYPlot, to set if cursors can snap to the plot or not.

I need the same feature in the wpf Plot (NationalInstrument.Controls.Plot), to make invisible plots not snappable. I have checked the plot properties and the cursor properties but I have only found the SnapToData property of the cursor (which is a boolean) and the AllowablePlots that can be set only to "Single" or "Any" values (is an enum type).

0 Kudos
Message 1 of 3
(5,388 Views)

Unfortunately, we did not have time to implement all of the cursor behaviors for the first release of the WPF graph controls. Currently, there is no property available on plots or cursors to configure snapping behavior to the level of granularity you want.

 

As a workaround, you can derive from Cursor and re-define its value snapping behavior. For example, the class below resets the position of the cursor if the nearest value is not on a visible plot:

 

    public class CustomCursor : NationalInstruments.Controls.Cursor {
        protected override void OnDragMoveCore( Point updatedCursorRelativePosition, object context ) {
            Point currentPosition = GetRelativePosition();
            base.OnDragMoveCore( updatedCursorRelativePosition, context );
            if( ActualPlot.Visibility != Visibility.Visible )
                SetRelativePosition( currentPosition );
        }
    }

~ Paul H
0 Kudos
Message 2 of 3
(5,380 Views)

Just wanted to let you know this issue was fixed in the Measurement Studio 2015 release.

~ Paul H
0 Kudos
Message 3 of 3
(3,898 Views)