Click to Rate and Give Feedback
MSDN
MSDN Library

  Switch on low bandwidth view
Silverlight Scripting Application Notes

Silverlight Scripting Application Notes

This topic contains the following section:

Numeric Values Stored as Single-Precision Values

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 double, the property value that is later retrieved may not be the same, due to truncation or rounding.

Limits on Floating Point Numbers

A floating point can be no larger than +/- 1,000,000.

Referencing an Event Handler Function

The following XAML example shows how to attach a handler for the Loaded event for the Canvas object. Notice that the reference to the event handler function name is not prefixed by "javascript:". That prefix was required for early prerelease versions of Silverlight, then made optional in later prerelease versions, but is not permitted in the release versions.

XAML
<Canvas
  xmlns="http://schemas.microsoft.com/client/2007"
  Loaded="onLoaded" />

The equivalent operation in script is to call the AddEventListener method. The second AddEventListener parameter that specifies the event handler function can be in two general forms: a quoted string of the function name, or a reference to the function name. For instance to parallel the XAML above, you could use either the syntax rootCanvas.addEventHandler("Loaded","onLoaded") or rootCanvas.addEventHandler("Loaded",onLoaded). You can also use a variation of the second syntax by explicitly creating a delegate for your function.

AddEventListener returns a token value that is necessary if you intend to remove that event handler through runtime script. For details see AddEventListener.

See Also

Silverlight Object Models, Using Silverlight Plug-ins, Silverlight Events

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker