ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NumericTextBoxDouble Binding Initial Value

Solved!
Go to solution

Hi,

 

I have a ni:NumericTextBoxDouble binded OneWayToSource to a Property. How do I set the Initial Value, which is show (an set) by starting up my program? Now it is showing 0.00.

 

<ni:NumericTextBoxDouble 
x
:Name="YMax" 
Value="
{Binding Path=MyYMax, Mode=OneWayToSource, ValidatesOnExceptions=True }" 
InteractionMode
="ArrowKeys, ScrollWheel, TextInput" 
Width
="58" 
Margin
="0,10" 
Cursor
="IBeam">                     <ni:NumericTextBoxDouble.ValueFormatter>                         <ni:GeneralValueFormatter  Format="0.00" ShortFormat="{x:Null}"/>                     </ni:NumericTextBoxDouble.ValueFormatter> </ni:NumericTextBoxDouble>
0 Kudos
Message 1 of 6
(6,291 Views)

I believe you can set FallbackValue to get a default value when using a OneWayToSource binding.

~ Paul H
0 Kudos
Message 2 of 6
(6,286 Views)

ni:NumericTextBoxDouble doesn't seem to have a FallbackValue property...

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

I solved the Issue with the following Workaround:

 

I set the Binding type to TwoWay, and gave the Property to a default value. It works, but not a perfect model of my data handling.

0 Kudos
Message 4 of 6
(6,257 Views)
Solution
Accepted by jtamaska

To clarify, I meant the FallbackValue property on Binding itself:


    <ni:NumericTextBoxDouble Value="{Binding Path=MyYMax, Mode=OneWayToSource, ValidatesOnExceptions=True, FallbackValue=1.1}" ...

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

I didn't think of that 😞 That solves it! Thank you!

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