This is a quick blog post announcing the availability of Silverlight.FX version 3.1 which is sync’d up to Silverlight 3. For those, who haven’t checked it out before - the one-liner description of Silverlight.FX - "a lightweight framework for building well structured RIAs". A more detailed description can be found on the project page, as well as various blog posts from the past.
For those, who have checked it out before, or are using it, there haven’t been significant changes. Here are the notable ones (I’ve used snippets from the New York Times sample where applicable):
XApplication replaced with ApplicationContext
XApplication used to derive from the Silverlight Application base class, and provided functionality such as theming, windowing, an IoC container etc. This has been replaced with an ApplicationContext service to be placed in the new Application.ApplicationLifetimeObjects collection introduced in Silverlight 3. Blend doesn’t like derived Application types, and this takes care of that.
Before:
<fxapp:XApplication
xmlns:fxapp="clr-namespace:SilverlightFX.Applications;assembly=SilverlightFX"
xmlns:appsvc="clr-namespace:NewsWidget.Services"
...>
<fxapp:XApplication.Components>
<appsvc:TimesNewsWireService />
</fxapp:XApplication.Components>
</fxapp:XApplication>
After:
<Application
xmlns:fxapp="clr-namespace:SilverlightFX.Applications;assembly=SilverlightFX"
xmlns:appsvc="clr-namespace:NewsWidget.Services"
...>
<Application.ApplicationLifetimeObjects>
<fxapp:ApplicationContext>
<appsvc:TimesNewsWireService />
</fxapp:ApplicationContext>
</Application.ApplicationLifetimeObjects>
</Application>
Integration with Browser Back/Forward in PageFrame (Navigation)
The navigation feature in Silverlight.FX (PageFrame, Page etc.) supports URI-based navigation capability that supports both simple mapping of URIs to Page types that you'd expect, as well as supporting a MVC-based navigation model, where URIs map to actions on controllers (both sync and async), and action results are mapped to views and view models. PageFrame also supports cross-page transitions (like cross-fade, flip, slide etc.) in a declarative manner.
<fxnav:PageFrame x:Name="mainFrame"
IsIntegratedWithBrowser="True">
<fxnav:PageFrame.Loader>
<fxnav:MvcPageLoader />
</fxnav:PageFrame.Loader>
<fxnav:PageFrame.Transition>
<fxtransition:CrossFade Duration="00:00:0.25" />
</fxnav:PageFrame.Transition>
</fxnav:PageFrame>
New Effects - Float and Spin3D
I couldn’t resist adding a couple of small new features that leverage some new capabilities of Silverlight 3. I’ve added the “Float” effect and the “Spin3D” effect. Note that effects in Silverlight.FX are behaviors that can be attached to elements and play an animation in response to various events. For example, the HoverEffect is a behavior that plays a forward animation upon mouse enter, and the inverse animation upon mouse leave (i.e. no need to deal with events, explicitly beginning/stopping storyboards, or defining storyboards for simple short-duration animations).
The Float effect simulates an object floating by projecting it forward along the z-axis, and by adding a drop-shadow behind it. The Spin3D effect rotates the element along one or more of the axes. Both of these effects use the new 3D plane projection and pixel effects under the covers. Here is some example markup:
<Border Background="#ED971F">
<fxui:Interaction.Behaviors>
<fxui:HoverEffect>
<fxeffects:Float Distance="100" ShadowLength="10" />
</fxui:HoverEffect>
<fxui:ClickEffect>
<fxeffects:Spin3D SpinAroundXAxis="True" SpinAroundYAxis="True" SpinAroundZAxis="True"
Duration="00:00:02" />
</fxui:ClickEffect>
</fxui:Interaction.Behaviors>
</Border>
Check out Glitz2Page.xaml for a running sample.
Miscellaneous
There are a few renames in the underlying infrastructure – for example Effect was renamed to AnimationEffect, so you don’t see ambiguous names with the newly introduced Effects functionality in Silverlight 3. None of these changes should affect apps themselves that were using effects declaratively.
From the project page, you can download all the sources and binaries along with samples, both mini-experiments, as well as more end-to-end app scenarios.
If you’re using Silverlight.FX, please do drop a note. I’d love to get a sense of the cool things people are doing with the framework. Also, if you have suggestions for what you’d like to see, please include them as well.
Posted on Thursday, 7/16/2009 @ 11:37 PM
| #
Silverlight