In This Article

DoubleEditBox

The DoubleEditBox control allows for the input of a Double (floating-point number) value. It uses the DoublePicker control in its popup.

Screenshot

Common Capabilities

Each of the features listed in the table below describe functionality that is common to most edit boxes. Please see the Edit Box Basics topic for details on each of these options and how to set them.

Feature Description
Has a spinner Yes, and can be hidden or optionally displayed only when the control is active.
Has a popup Yes, and can be hidden or its picker appearance customized.
Null value allowed Yes, and can be prevented.
Read-only mode supported Yes.
Non-editable mode supported Yes.
Has multiple parts No.
Placeholder text supported Yes, and overlays the control.
Header content supported Yes, and appears above the control.
Default spin behavior No wrap.

Number Formats

Standard .NET numeric formats are supported via the Format property and affect the textual value display. These formats are recommended:

  • "C" (currency)
  • "F"
  • "Fx", where x is the number of decimal places (e.g., "F1")
  • "G"
  • "N"
  • "Nx", where x is the number of decimal places (e.g., "N1")
  • "P" (percentage)

Basic custom numeric formats are also supported, such as:

  • "0.0#' ft'"

Minimum and Maximum Values

Minimum and maximum values may be assigned via the Maximum and Minimum properties.

No values can be committed that lay outside of the inclusive range created by those properties.

Parts and Incrementing/Decrementing

This edit box has a single part.

When the caret is over a part, the part value may be incremented or decremented. Please see the Edit Box Basics topic for information on how to do this.

Small value changes alter the current number component by 1, which is the default for the SmallChange property. Large value changes alter the current number component by 5, which is the default for the LargeChange property.

The CanSnapToChangePrecision property determines whether the value should be snapped to the precision of the incremental change value prior to applying the increment.

The DefaultValue property sets the value that will be set when incrementing or decrementing from a null value.

Rounding Decimal Places

The RoundingDecimalPlace property determines the maximum decimal place at which to round floating-point numbers. It defaults to 8 but can be set to any value in the range 0 to 15. Or set the value to null to prevent rounding.

Allowing NaN or Infinity Values

Text entry of NaN (not-a-number) and infinity values into the edit box is not allowed by default.

Set the IsNaNAllowed property to true to allow a NaN value to be entered by typing the letter N.

Set the IsNegativeInfinityAllowed property to true to allow a negative infinity value to be entered by typing a negative sign - and then the letter I.

Set the IsPositiveInfinityAllowed property to true to allow a positive infinity value to be entered by typing the letter I.

Built-in Picker Kinds

This edit box has multiple built-in picker kinds that can be set via the DoubleEditBox.PickerKind property, which is of type DoubleEditBoxPickerKind.

The default value in WPF is Calculator.

The Default picker kind renders using a radial slider, while the Calculator picker kind utilizes the Calculator control.

Screenshot

Sample XAML

This control can be placed within any other XAML container control, such as a Page or Panel with this sort of XAML:

<editors:DoubleEditBox Value="{Binding Path=YourVMProperty, Mode=TwoWay}" />

Sample XAML for Currency Input

Screenshot

This control is great for currency input, which can be implemented with this XAML:

<editors:DoubleEditBox Format="C" Value="{Binding Path=YourVMProperty, Mode=TwoWay}" />