Tag Archives: Silverlight

Exploring M-V-VM

A couple of years ago a collegue recommended Data Binding with Windows Forms 2.0: Programming Smart Client Data Applications with .NET and i noticed that my code started to gravitate towards an Model-View-ViewModel architecture. Due to shortcomings and painful experiences i gave up on databinding and began to use Passieve View instead.

Passive View doesn’t work (well) with smart views so i decided to give M-V-VM another because i really wanted to leverage WPF’s rich support for databinding.

The key difference between M-V-VM and Passive View is, imho, the fact that the ViewModel is unaware of the View unlike Passive View where the Presenter knows about the (simple) View.

When we test a Presenter i notice that we end up writing interaction based tests (assertions on a mocked view) and when we test a ViewModel we end up writing state-based tests instead.

Sokoban: Creating graphics with Expression Design

Earlier this morning i decided to improve the graphics the little. I launched Expression Design, created a new image, and drew each possible cell and piece in a seperate layer. With this technique i can easily preview how a “Box” on “Goal” looks like.

For each layer i simply copied the XAML from Expression Design into my Cell.xaml file. Apparently all the layers are interpreted as a Canvas and the layer name determines their x:Name which makes it pretty easy to make the correct canvasses visible. With a simple ScaleTransform i can ensure that the canvasses are sized correctly.

Here is the updated version of Sokoban:

Presenting Sokoban with Silverlight

Despite the blablah postings, i have been able to code a little, so here is the boomboom: Sokoban.

Silverlight wishlist

Here are the features that i would love to see in Silverlight:

  • Allow users to copy text from the UI (Or was the UX argument an excuse for playing with new toys?)
  • MSTEST (I know that Silverlight Unit Test Framework exists.)
  • Triggers (including data triggers)
  • Typed data templates
  • Uniform XAML (WPF: <Style TargetType={x:Type local:Foo}/> vs Silverlight: <Style TargetType={local:Foo}/>)
  • Uniform validation API (eg: Data Annotations has three flavors)
  • XAML with less namespaces (doesn’t really matter if you’re a designer only type)
  • Support for Desktop (‘regular’) .NET assemblies. As long as Desktop .NET assemblies are not supported, tools that automate the process of generating a ‘shadow’ .Silverlight project (eg: Prism has for each project a silverlight project that, ignoring the different assembly references, exists out of file references to the orginal project).
  • UniformGrid

Note: This list is not exhaustive and may change in the future.