Home > Articles > Programming > ASP .NET

Silverlight Best Practices: The MVVM Pattern

  • Print
  • + Share This
One of the most popular Silverlight patterns and best practices is the Model-View-View Model pattern, or MVVM. The pattern takes advantage of the data-binding features that are part of XAML technology. Jeremy Likness, Microsoft MVP for Silverlight, walks you through the fundamental components of this pattern and shows you a simple, straightforward approach to implementing it in Silverlight line-of-business applications.
Like this article? We recommend

Like this article? We recommend

Silverlight was introduced in 2006 under the awkward acronym WPF/E or “Windows Presentation Foundation/Everywhere.” The stated goal was to bring the XAML-based technology to multiple platforms and browsers. XAML stands for Extensible Application Markup Language and is a standardized way of defining complex object graphs that compose user interfaces. It is most well-known for its role in Silverlight and WPF applications to provide user interface (UI) layout and design. The first version of Silverlight used JavaScript extensions to interact with XAML, but the next version provided a stripped-down version of the Common Language Runtime (CLR) provided with the full .NET Framework for the runtime.

The early messaging around Silverlight focused around rich multimedia experiences and the ability to play movies within a browser. Many consumers felt that Silverlight was simply another video player plug-in designed to compete with the ubiquitous Flash player. It wasn’t until 2009 and version 3.0 that Silverlight applications became prevalent in the enterprise. The ability to write an application once and have it run with exactly the same functionality and user interface on multiple platforms and browsers, along with the ability to operate in off-line mode when disconnected from the Internet, made it the perfect candidate for business applications.

Silverlight has powered applications ranging from server monitoring systems for large redundant data centers to rich interactive online schedules for cable providers. Through SharePoint integration, Silverlight has provided rich interactive interfaces for financial risk management applications. It has been used in military applications, educational software, and for medical field technology. Silverlight has established itself as a powerful framework for building line-of-business applications.

This series will focus on best practices for using Silverlight to write commercial applications. Enterprise applications have unique requirements that can be addressed using various patterns and solutions that are available within the Silverlight framework. This first article will examine the common MVVM pattern. MVVM is the abbreviation for model-view-view model. This pattern is a variation of the MVC pattern, or model-view-controller. It is popular in line-of-business Silverlight applications because of how well it works with XAML and data-binding.

Design Pattern Versus Framework

MVVM is a design pattern. A design pattern is a general solution for a software problem that can be reused across different projects. It is a concept and not a specific code base. It is important to understand the difference between the pattern and the framework. MVVM as a pattern does not dictate how the pattern is implemented nor does it provide specific code, but instead provides the general solution to separate concerns in applications that use data-binding.

A framework, on the other hand, is a collection of code that provides specific functionality. Frameworks often provide libraries that can be accessed via a well-defined Application Programming Interface (API). Frameworks are often flexible and extensible, but do implement core functionality that is intended to be reused rather than modified. There are several frameworks available for Silverlight that implement the MVVM pattern. These will be discussed after the pattern itself has been defined.

  • + Share This
  • 🔖 Save To Your Account