Taking snapshot of playing video … Handling already-handled route event …. Silverlight 3 has many new features, hasn’t it? Read my post about these two features.
Bitmap API
One of the new features in Silverlight 3 is the Bitmap API which provides the ability to render UIElements to a bitmap and provides direct access to the pixel level information of bitmaps. It is useful for taking snapshots of playing video, generating fractals, and for data visualization. The key to generating a bitmap is the WriteableBitmap class. Note that it does not render popup controls, such as Popup, ToolTip and ComboBox.
- http://community.irritatedvowel.com/blogs/pete_browns_blog/archive/2009/03/18/Silverlight-3-_1320_-The-Bitmap-API-_2F00_-WriteableBitmap.aspx
- http://www.smartypantscoding.com/content/rendering-text-writeablebitmap-silverlight-3s-bitmap-api
- http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap(VS.95).aspx
Routed Events: AddHandler
The API AddHandler provides a technique whereby you can attach a handler that will always be invoked for the route, even if some other handler earlier in the route has set Handled to true. This technique is useful if a control you are using has handled the event in its internal compositing or for control-specific logic but you still want to respond to it on a control instance, or higher in the route.
In order to use AddHandler, the routed event must expose a public static field that is the event identifier, which is required for the routedEvent parameter. This is only true for a limited set of events in the Silverlight core classes: KeyDown; KeyUp; MouseLeftButtonDown; MouseLeftButtonUp. Do not use Loaded event and AddHandler; Loaded is not a true routed event in the Silverlight implementation. MouseMove cannot be used with AddHandler because there is no Handled in its event data. BindingValidationError cannot be used with AddHandler because there is no event identifier, and also because there is no control handling of the event.
No comments:
Post a Comment