Sunday, December 27, 2009

New features in Silverlight 4 Beta: Implicit Styles & CompositeTransform

In this post I’ll show two useful features: implicit styles and new transform - CompositeTransform.

Implicit Styles


Useful links



Useful links

New features in Silverlight 4 Beta: Out Of Browser Applications (Trusted)

I previously wrote a post about new features of sandboxed out of browser applications. This post focuses on trusted applications.

Trusted application features

  • Install requires users to “trust” the application
  • Group Policy support for
    • Disabling installation of Trusted Applications
    • Disabling activation of Trusted Applications


  • Native Integration / COM Automation objects on Windows
    • ComAutomationFactory
    • C# 4.0 “dynamic” programming model
    • Standard language feature in Visual Basic
    • Automation features supported in SL 4 Beta
      • Property get/set, indexed property get/set
      • Positional and optional parameters
      • Support by ref and by value
      • In proc and out of proc servers
      • Sink dispatch events with arguments
    • Automation features not supported in SL 4 Beta
      • Marshalling user defined types
      • Multi-dimensional or jagged arrays
      • Named parameters
      • IEnumVariant
      • Type Information


  • File System Access
    • Folders: MyDocuments, MyMusic, MyPictures, MyVideos
    • These folders are distinct from the Windows 7 Libraries


  • Relax sandbox speed bumps
    • Enable cross domain HTTP networking
    • Eliminate site locking for WebBrowser
    • Full path in Open/SaveFileDialog
    • Eliminate user initiation
      • Open/SaveFileDialog
      • Clipboard access
      • Full screen mode
      • Changing window settings
    • Enable full keyboard in full screen mode


Useful links

Monday, December 21, 2009

New features in Silverlight 4 Beta: Out Of Browser Applications (Sandboxed)

Out of browser applications are cool, aren’t they? In the near future I’ll write two posts about it. Today I’ll present enhancements of sandboxed applications.

Sandboxed out of browser additions:

  • Web Browser/HTML hosting
    • WebBrowser control
    • HtmlBrush
  • Window settings
    • Runtime changes to Height/Width
    • Specify startup location (in manifest)
    • Runtime control over WindowState (Normal, Minimized, Maximized)
    • Supports “TopMost” Apps (toolbar apps)
    • Enable App “Activate” (Normal window state - bringing to front, Minimized - flashing the taskbar)
  • Toast notifications (NotificationWindow)
  • DRM media playback
  • Add/Remove Program Integration

WebBrowser control is cool, but it doesn’t support opacity, rotation, effects and overlaid content (Silverlight content on HTML).

HtmlBrush requires manual refreshing (Refresh method).

NotificationWindow also has some limitations:

  • Size up to 400 x 100
  • Popup duration to 30 seconds
  • Cannot set opacity and rounded corners
  • Cannot launch popup windows
  • Location is fixing per operating system (Windows - lower right, OS X - upper right)

out-of-browser_0 out-of-browser_1out-of-browser_2

You can make much more. Look at cool HTML Puzzle example from PDC ! 


Useful links

Friday, December 18, 2009

New features in Silverlight 4 Beta: RichTextArea Control, Right to Left Flow Direction & Text Trimming

Have you checked out the new cool RichTextArea control or TextBlock with trimming ? Read this post.

The RichTextArea allows hyperlinks, XAML content, and embedding of images. It supports changing the font size, foreground color, and making text bold, italicized, and underlined.  Paragraph blocks allow different formatting of blocks of text. Mouse events, clipboard, undo, language localization are also supported.


Some limitations

  • UI elements and hyperlinks are active only in read-only mode.
  • You can cut, copy, or paste only plain text.
  • Undo is supported only if the IsReadOnly property is false.


You can now set the direction of content and layout of each control to flow from right side to the left (which is useful for some languages such as Hebrew or Arabic). All UIElement controls inherit the FlowDirection from their parent except Image, MediaElement, MultiScaleImage and Popup. When brushes and effects are applied to elements whose FlowDirection property is set RightToLeft, the result is flipped horizontally.


The TextBlock has a new TextTrimming property. When this property is set to WordEllipsis and the text in the TextBlock exceeds the visible limit, the text appears truncated with a trailing three ellipsis.


Other text improvements

  • Arabic and Hebrew Text Support
  • IME (Input Method Editors) improvements for TextBox
  • UIElement: TextInputStart, TextInputUpdate, TextInput events

Useful links: 

Wednesday, December 16, 2009

New features in Silverlight 4 Beta: Navigation Page Loading Extensibility & Data Binding Changes

Today I’ll show two new Silverlight 4 features: custom navigation and data binding enhancements.

Navigation Page Loading Extensibility

Now you can extend the navigation system by setting a new ContentLoader property of the Frame class to a custom INavigationContentLoader implementation. The default ContentLoader property value is an instance of the PageResourceContentLoader class.


Useful links


Data binding changes

I have made two sample applications to demonstrate new data binding features.

Data Binding Sample One

  • Validation with IDataErrorInfo interface (ValidatesOnDataErrors)
  • String formatting, Null and Fallback values (StringFormat, TargetNull, FallbackValue)
  • Databinding support for dependency objects
  • Grouping on CollectionViewSource


Data Binding Sample Two

  • Synchronous and asynchronous validation with INotifyDataErrorInfo interface (ValidatesOnNotifyDataErrors)
  • Command property on ButtonBase and Hyperlink (in the sample: Button)
  • Binding to string indexers
  • SelectedValue and SelectedValuePath on the Selector (in the sample: ComboBox)


Other data binding  improvements

  • ObservableCollection<T> constructor that takes IEnumerable or IList
  • IEditableCollectionView (for example PagedCollectionView)

Useful links

Friday, December 11, 2009

New features in Silverlight 4 Beta: Fluid UI States for ItemsControl

Now you can animate items into/out of ItemsControls ! Read this post.

The ListBoxItem has a new visual state group called Layout States that has BeforeLoaded, Loaded, and Unloaded visual states. These visual states help animate the transition between states when an item is loaded and unloaded from an ItemsControl. Fluid states are applied to containers generated from a DataTemplate.


Useful links

Thursday, December 10, 2009

New features in Silverlight 4 Beta: MouseWheel Support, Clipboard Access & DataGrid Enhancements

Today I’ll write some information about clipboard, new features of DataGrid and mouse scrolling.

Silverlight 4 adds the ability to programmatically access the clipboard to format and modify data during copy, cut, and paste operations (text only). When an attempt is made to programmatically access the clipboard for the first time, Silverlight will prompt the user to request permission.


You can copy a row of a DataGrid to the clipboard (CTRL + C) and then paste it to another program (f.e Excel). You can control what is copied for a particular column by using the DataColumn.ClipboardContentBinding property to point to different data if the cell contents aren’t what you want to have copied.

The DataGrid in Silverlight now has the ability to allow columns to share the remaining width of a DataGrid (*).  It also supports MouseWheel scrolling and the FlowDirection property.


Useful links

Wednesday, December 9, 2009

New features in Silverlight 4 Beta: Dragging Files and Right Click

Silverlight version 4 Beta introduces APIs to support dragging a file list to a Silverlight application. You can also handle right-click mouse events and change the behavior (for example show context menu). In this post I’ll show demo with these new features.


There’ re some limitations with current drag and drop implementation. Only file drag and drop is supported. For drag and drop to work on Windows, Silverlight plugin must be windowed (<param name="windowless" value="false"/>). In order to use drag-and-drop events for applications hosted by Safari on Macintosh, you must forward the relevant DOM events from your own HTML-level scripting to the specific API of the control.

Useful links

Sunday, October 18, 2009

My longest post: .NET Ria Services July Preview - summary

I have tested many features of .NET Ria Services July Preview and scenarios for three weeks. I have read  Microsoft .NET RIA Services Overview document, materials from .NET Ria Services Samples page and excellent Brad Adam's and Nikhil Kothari’s blogs.  I have made some my samples which I’ll present them in this post.

I sign .NET Ria Services features used in my samples:  

  • New feature of July Preview
  • Modified feature
  • Feature known from previous releases 
  • Extensions from Microsoft samples

Business Application Demo

  • The automatic detection of shared code
  • Operations
    • A new model for handling operations on the client
      • Load/Invoke/Submit operations
      • Value that will update itself when the operation completes, callbacks and completed event
    • Changed signatures for query and update operations
    •  POST support for Query operations
  • DomainDatasource
    • Changed parameters
  • Authentication
    • RiaContext, FormsAuthentication
    • Roles and profiles
  • New Silverlight Business Application VS template
    • Activity and DataForm controls
    • Forms and Windows authentication
  • Code Generated Hookpoints
    • DomainContext Hookpoints
    • Entity Hookpoints
  • Computed properties
  • Localized error messages
  • Changed validation API
  • ASP.NET: DomainDataSource

Activity MainValidation Login RegistrationSettings1Settings2ASPNET

Server validation &  resolving concurrency conflicts


Windows Authentication


A Https Enabled DomainService

DomainContext: cross-domain scenario

Loading Data from Related Entities

  • Returning Related Entities
  • Denormalizing Associated Data

Hierarchical Data

  • Returning Related Entities
  • Computed properties


Multiple DomainContexts

  • Cross-DomainContext references: associations with entities originating from different DomainContext

.NET RIA Services Class Libraries 

  • .NET Ria Services Class Library VS template


Out of browser Silverlight client


ASP.NET Dynamic Data integration

Required ASP.NET Dynamic Data Preview 4 Refresh


AJAX client


ASP.NET MVC  integration


Exposing DomainService as DataService (Domain ADO.NET Data Service) 

  • Domain ADO.NET Data Service VS template
  • WPF client (and other full .NET client)
  • Silverlight client

Silverlight client doesn’t work for me (I have built the sample described in Microsoft .NET RIA Services Overview). If you know what should be done to fix it, please write to me.


Exposing DomainService as WCF service

ADO .NET Data Services Based Data Source

WCF Based Data Source

DataSet Based Data Source

NHibernate Based Data Source

Offline synchronization

  • LocalSyncBehavior
  • ServerSyncBehavior

You need attach these behaviors to DomainContext. You can download them  from TechEd South Africa Ria Services samples.

I haven’t verified if ServerSyncBehavior worked well. If you know how it works , please write to me.


Other useful samples I have found: