Sunday, June 20, 2010

Expression Blend 4: Fluid UI - Enhanced FluidMoveBehavior & Layout States

In Blend 4, Fluid Layout has many new tricks. You can now define layout animations between a master list and a detail view and animate things that move between lists. You can also animate the process of items being added to and removed from a ListBox.

An exciting enhancement has been made to the FluidMoveBehavior.

FluidMoveBehaviorMasterDetail
01_FluidMoveBehavior_MasterDetails_01 01_FluidMoveBehavior_MasterDetails_0201_FluidMoveBehavior_MasterDetails_03 - Mod

By using FluidMoveBehavior together with FluidMoveSetTagBehavior, you can animate a transition from a specified starting point, even if that initial location is specified only by a reference to the data that is displayed in your application and may exist in a different scope. Data tagged by FluidMoveSetTagBehavior is available for use with FluidMoveBehavior by using a hidden data store.

FluidMoveBehavior is optimized for two main scenarios: animating from a master list to a detail view and animating list items from one list to another.

FluidMoveBehaviorListToList
02_FluidMoveBehavior_ListToList_0102_FluidMoveBehavior_ListToList_03

In Silverlight 4, a special VisualStateGroup called LayoutStates has been added specifically for animating adding items to and removing items from a ListBox (or custom ItemsControl). You may have a look at my previous post (updated sample you can get from here).

If you also apply a FluidMoveBehavior behavior to the items panel of the ListBox, existing items will smoothly make room for entering new items.

02_FluidMoveBehavior_ListToList_02

Useful links

Thursday, June 10, 2010

My offline extension of DeploymentCatalog

DeploymentCatalog works well in many scenarios. However, when you start  Silverlight out of browser application in offline, cached .xap is not found. So I have extended standard DeploymentCatalog to support offline scenario.

How my offline extension works?

In online out of browser application downloads (or gets from cache) .xap file and saves it  in an additional place - MyDocuments folder. I use trusted mode, so saving works without user interaction and space limit.

When you start out of browser application in offline, .xap file is loaded from MyDocuments folder.

MEF_Offline_Xap_2

I have created DeploymentCatalogWithOffline based on modified DeploymentCatalog sources.  I have changed only implementation of  HandleOpenReadCompleted method (see the screenshot below).

MEF_Offline_Xap_1

You can download complete solution here.

Tuesday, June 8, 2010

Silverlight 4 RTW Samples - part II

I wrote a post with part I of my Silverlight 4 RTW practical summary a  few days ago. Today I’ll continue this topic.

I sign changes in my samples:  

  • API changes or/and new features
  • new sample showing new features

Let’s continue …

9. Out of browser applications - sandboxed (SandboxedOutOfBrowser, MultiTouchPuzzle)

Now you can silent install out of browser application without … browser. You can also launch application without installing.

10. Out of browser applications - trusted (TrustedOutBrowser)

Upon installation of an elevated trust application end user’s will be presented with dialogs shown below.  XAP signing reassures end users of the authenticity of an application’s publisher and that the code has not been tampered with.

Trusted_OOB_WithoutSigningTrusted_OOB_WithSigning

You should experiment with custom window chrome! Your application may look more distinctive!

Silverlight 4 adds the ability to discover when an OOB application’s window is being closed. The Closing event offers the opportunity to cancel this operation in trusted applications.

Trusted_OOB_CustomChrome

11. Implicit styles (ImplicitStylesDemo)

12. CompositeTransform (TransformDemo)

13. MEF (MEF, MEF2, HousePlanner, ExtensibleGrid, SilverlightMEFNavigation)

MEF in final Silverlight 4 has some changes from beta. For example, it contains new DeploymentCatalog.

14. Communication - multicast, authentication & WCF (MulticastChat, ClientHttpStackAuth, WcfTcpBinding, WcfDuplexTcpBinding, VideoChat)

When using a service configured with NetTcp binding, Silverlight does not honor TCP policy served by the server at port 943. This is one of some known WCF issues in Silverlight 4.

WCF_Video_Chat

15. Communication - WCF Data Services (WcfDataServicesDemo, BinaryDataStreamingDemo)

I have added demonstration of server-driven paging and partial entity sets to WcfDataServicesDemo example.

You can work more efficiently by using Visual Studio 2010 Data Sources window !

WCFDataServices_DataSourcesWindow

OData protocol defines a mechanism for accessing binary data separate from an entity to which it belongs. OData service can expose large binary data as a media resource that belongs to a media link entry. The WCF Data Services client for Silverlight can consume a media resource from an OData service as a binary stream.

WCFDataServices_BinaryStream1WCFDataServices_BinaryStream2

16. XML - XPath (XmlDemo)

Silverlight 4 RC/RTW introduces XPath support including XPathNavigator and LINQ to XML extension methods for evaluating XPath expressions on your XElement objects!

XmlXPath

17. New C#4 & platform features (CSharp4, ModifyHTMLbyNET)

18. ViewBox (ViewBoxDemo)

19. Toolkit - ContextMenu & Theming (ThemesDemo)

Silverlight 4 Toolkit April '10 introduces some new features and changes

ThemesDemo example shows new SystemColors theme, using themes at application and page level, custom theme, changing themes at run-time with ContextMenu control.

Toolkit_Themes_App Toolkit_Themes_Menu_Changing Toolkit_Themes_Menu_Xaml Toolkit_Themes_Menu_Code

All samples from part two you can download here

 

Silverlight 4 Tools for Visual Studio 2010 also contains some interesting features. See great video on Silverlight TV!