Dispatching in Silverlight

Anyone who has been building Silverlight and/or WPF applications for some time understands that there is a single UI thread that has special access requirements if you are going to be updating elements. In other words, if I spin off a new thread, I cannot arbitrarily impact the UI unless I get back to the…

Unit Tests for ViewModels AND Views in Silverlight

Over the past few posts I’ve been exploring models for modularized Silverlight applications that follow the MVVM pattern (using Prism/CAL). In this post, I’d like to cover unit testing, and writing appropriate tests not just for the view model, but the view itself. Before we continue, I’m going to assume you’ve read: Dynamic Module Loading…

Simplifying Asynchronous Calls in Silverlight using Action

This post explores a way to encapsulate web service calls from Silverlight in a way that is easy to use and understand. As anyone who works with Silverlight knows, Silverlight forces web service calls to be asynchronous. There is a good reason for this, which I won’t get into with this post. What I would…

MVVM Composition in Silverlight 3 with Prism

This post explores how to manage multiple view models across modules in a Prism-based Silverlight application. One powerful feature of Prism is the ability to dynamically load modules. This allows reduction of the XAP file size, as well as encourages a smaller memory footprint as certain modules are not brought into the application until they…

Host WCF as Windows Service without Installing

I am working on a project that involves a centralized UI that then coordinates with agents to send out instructions. The agents will be WCF endpoints and to ease deployment/minimize the install footprint, they will install as windows services with a nice installer rather than hanging onto an IIS webspace directly. In this post I…

Silverlight MEF: Custom ExportProvider for Attached XAML Exports

I’ve been enjoying learning more about the Managed Extensibility Framework (MEF) and exploring various ways to integrate it with applications. After toying with MEF on Silverlight for awhile, I began to wonder about using it to export/import UI pieces or even define data elements in XAML. After a tweet to @gblock confirmed there was not…

MEF: Build a Plugin in Under 10 Minutes

In preparing for an upcoming talk I’ll be giving on the Managed Extensibility Framework (MEF), I wanted to demonstrate how fast and easy it is to use in a sample, reference application. This application creates a dynamic plugin. I first link a plugin and show it active, then I create a second plugin and show…

RIA POCO DomainService with Existing Business Applications in Silverlight

Your boss suddenly decides that Silverlight is the “next big thing” and asks you to begin converting your line of business application to use the new features. Being a solid architect, of course, you have already built a nice application that is structured in layers. You have a data access layer that abstracts persistence behind…

Silverlight 3, RIA services, and Resource (RESX) Files

One of the advantages of using RIA services is that you can build your domain entity tier independently from the rest of the application tiers and then wire it in as needed, whether as LINQ or simple POCO classes. If you decide to annotate your entities with resources, it can get a little dicey. Most…

Getting Silverlight Applications Ready for the Real World

As I continue to work on a reference project (basically building my portfolio site out in Silverlight) I keep going back to what it takes to put a Silverlight application “out there.” When is it really “code complete?” There are tons of blog posts and articles about unit testing, frameworks, line of business, etc, but…

Rich Data Forms in Silverlight 4 Beta

Silverlight 4 provides some very powerful data form capabilities out of the box. You will no longer have to throw an exception just to send a validation error or even worry about hard-coding labels. With support for data annotations, IDataErrorInfo and more, you now have plenty “out of the box” to work with. Let’s explore…

Revisiting Lorem Ipsum in Silverlight 4 with RichTextArea and Printing

Earlier I explored some options to allow inline hyperlinks in Silverlight 3 using some extensions and the WrapPanel. In Silverlight 4, which was released as beta earlier this week, the problem is solved in the framework. Silverlight 4 gives us the RichTextArea control, which allows us to organize runs, spans, paragraphs, and even embed other…