Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
505
Initial display options for UltraNumericEditor
posted

Another question about the UltraNumericEditor...

 I am binding the UltraNumericEditor to a nullable double (aka double?, aka Nullable<double>).  If the value really is null, I'd prefer not to display a number in the control. I can do this no problem.  However, the user must then enter a number manually into the control rather than hit the spin buttons (they are greyed out).  I can also, use the DataBindings - Advanced to set up a value for when the underlying business object is null.  However, this isn't really appropriate either as it gives the user the impression that there is a value already in the model.

 One solution would be to display nothing (or perhaps the word "Null" or "Enter a value"?) in the control BUT have the spin buttons enabled.  When the spin button is first hit, the values should start from some value (say 0.0 or 1.0).  Is this possible?

Any ideas on best practices or relevant posts would be most appreciated.  I did look through the posts, but in this case, it's hard to even know the keywords to search on.

 I have attached a simple project that shows to UltraNumericEditors bound to the the same business object.  In one, I don't bother to set a default value, and the user must type inside the edit box to get going.  In the other, I use the DataBindings - Advanced to set a default value.  Neither solution is ideal.

 

Thanks,

Andrew

NumericUpDownPossibilities.zip