Share via


Double

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Represents a floating-point number.

<object property="nnnn" ... />
-or-
<object property="nnnn.nnnn" .... />

Managed Equivalent

Double

Remarks

Double does not have any callable APIs.

The nnnn placeholder values in the XAML syntax shown do not imply precision. Silverlight stores all numeric values internally as single-precision values. This means that if a property value is set to a higher precision value, such as a true double, the property value that is later retrieved may not be the same, due to truncation or rounding.

Silverlight defines Double as a value type in order to provide type conversion behavior for XAML, compatibility with the WPF XAML subset, and to support animating a Double. There is no type/object backing for Double in the JavaScript API for Silverlight. For property values or method parameters in scripting, use a floating-point value (you do not need to specify a decimal point followed by a zero if your number is really an integer—integers are evaluated correctly). For attributes, use a quoted value, again either with or without a decimal point. A Double value is inherently signed. However, not all properties that use the Double type will accept negative values. See the Remarks or Property Value sections of the specific property for guidance.

For Double values, particularly those that specify pixels or measurements for objects that are rendered on-screen, values that exceed one million (1000000) may be interpreted as values with a maximum of or near 1000000, or may raise errors, with the exact behavior varying depending on the property being set.

In general, the constraint behavior for Double values that exceed a property's minimum or maximum value will vary on a per-property basis. Some properties will constrain a value to its possible minimum or maximum; other properties will raise an error.

Some Silverlight property values that take a Double are intended to handle only values between 0 and 1, with 0 typically representing a minimum value supported by the property and 1 representing the maximum. For example, in the default RelativeToBoundingBox mode for a LinearGradientBrush object, the Double in the Offset value for the GradientStops (LinearGradientBrush) property is a value between 0 and 1 that defines the relative position in the total bounding box.