Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

SI Unit formatting in WPF

We have been using NationalInstruments.UI.WindowsForms.NumericEdit with FormatMode = NationalInstruments.UI.NumericFormatMode.CreateEngineeringMode("S0\'W\'", false) because we want the value to be displayed in W, mW, µw or nW depending on what is most suitable for the given value.

 

Now we want to do the same thing in WPF. How can we do that?

 

ni:NumericTextBoxDouble has a ValueFormatter propery but what should I set it to?

 

Regards @nders

0 Kudos
Message 1 of 2
(5,614 Views)

Unfortunately, the WPF controls do not have built-in support for SI format values. However, you can use the custom value formatter from this answer to a similar question to use the Windows Forms format strings:


    numeric.ValueFormatter = new EngineeringValueFormatter( "S0\'W\'" );

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