0

Is it possible to set the Minimum value of the IntegerUpDown (or any UpDownBase) to null?

The way I would like the control to operate is:

  • Initialize as null
  • Start at 0 if the user increments the spinner
  • Return to null if the user decrements from 0

I tried various combinations of setting IntegerUpDown.Minimum and IntegerUpDown.DefaultValue, but the setter on the property binding seems to re-invoke with the previous value after nullifying (can update with explanation if warranted).

UndeadBob
  • 1,110
  • 1
  • 15
  • 34

1 Answers1

0

You can define nullable integer (or other variables that doesn't have the null option by default) like this:

int? IntegerUpDown = null;
if (IntegerUpDown.HasValue)
{
    int NewInt = IntegerUpDown.Value;
}
Mohamad Rashidi
  • 307
  • 2
  • 14
  • I guess @reasra is talking about a [WpfToolkit](http://wpftoolkit.codeplex.com/) control... – Il Vic Jun 13 '17 at 12:22
  • Well, this is the basics of setting a variable as nullable, he/she should do the rest :D – Mohamad Rashidi Jun 13 '17 at 12:26
  • Thanks for your answer. I have the value bound to a `int?`. I would simply like the user interface to set the value to `null` with the `IntegerUpDown`'s spinner. – UndeadBob Jun 13 '17 at 12:33