Measurement Studio for .NET Languages

Showing results for 
Search instead for 
Did you mean: 

Modify the Cursor Value/Label in wpf

Go to solution



I have a graph from NI Measurement Studio 2013 WPF


I've insered a cursor into it.


I would like to show the cursor value but only the x value.


How to do this ?

0 Kudos
Message 1 of 5

If you want a single interactive line, consider using a MultiPlotCursor instead of a Cursor. This can be configured to only show the value of the horizontal axis by excluding association with any plots (using an empty include list):


<ni:MultiPlotCursor AllowablePlots="Include:" />



Otherwise, you would need to create a custom class to use as the ValuePresenter for the cursor, and have it only display the first dimension of incoming data. Something like this:


protected override string FormatCore<TData>( TData value, ValuePresenterArgs args ) {
    string result =
        value is IList dimensions
            ? DimensionFormatter.Format( dimensions[0], args )
            : DimensionFormatter.Format( value, args );
    return result;


~ Paul H
Message 2 of 5

Hello Phansen,


Thank you for the answer.


For the second solution, I don't understand your solution. 🤔.


the Cursor.ValuePresenter property type is ValuePresenter and I don't understand how to use your proposition.






0 Kudos
Message 3 of 5
Accepted by topic author Flow75

Sorry for the isolated example code! Attached is a complete implementation of a custom value presenter class.

~ Paul H
0 Kudos
Message 4 of 5



sorry for the delay, some other stuffs to take care 😋.


I've finally managed to integrate your code into my application


Some adaptation to downgrade into c# 4.8 but all is ok !


Thx very much.



0 Kudos
Message 5 of 5