Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

wpf engineering value formatting

Solved!
Go to solution

In Measurement Studio WF there is engineering formatter:

NationalInstruments.UI.FormatString fs = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Engineering, "S2");

 

Is there similar formatter in WPF? I've found only standard formatters like 

var fs = new GeneralValueFormatter("0.###");

0 Kudos
Message 1 of 6
(6,240 Views)

Hi Eugenem

 

The closest thing I can find is the EngineeringFormatInfo class, although it's not a WPF element.

I don't believe there is currently a WPF string formatting class or namespace which is part of the Measurement Studio package.

 

Kind Regards

Chris | Applications Engineer NIUK
0 Kudos
Message 2 of 6
(6,239 Views)

thanks! 

 

this one is good for manual formatting

 

how do I apply it to graph axis?

 

now I use 

ax.MajorDivisions.LabelPresenter = new GeneralValueFormatter( config.format );

0 Kudos
Message 3 of 6
(6,232 Views)

Hi Again

 

I've taken another look and in WPF the graph formatting is done using XAML, unfortunately the only formatting options for the axis numeric that I can see are DateTime, Double, Int32 or PrecisionDateTime. i.e. the attached picture.

I think the answer to your original question is no for the moment.

 

Kind Regards

 

Chris | Applications Engineer NIUK
0 Kudos
Message 4 of 6
(6,225 Views)
Solution
Accepted by topic author eugenem

As Chris mentioned, the WPF controls do not currently support engineering format values. However, implementing a custom formatter using the EngineeringFormatInfo class is fairly trivial, and does not involve creating a new axis type.


See the attached file for an example implementation. You can use it in your code like so:


    ax.MajorDivisions.LabelPresenter = new EngineeringValueFormatter( "S2" );

~ Paul H
0 Kudos
Message 5 of 6
(6,215 Views)

Thanks, did it this way.

0 Kudos
Message 6 of 6
(6,207 Views)