background preloader

MVVM

Facebook Twitter

Jounce: MEF with MVVM Guidance for Silverlight. MVVM with MEF in Silverlight: Video Tutorial. This is a video tutorial to introduce beginners to how to use both MVVM (Model-View-ViewModel) and MEF (Managed Extensibility Framework) with Silverlight (should work for versions 3 and 4). Of course, some "veterans" may want to watch as well in case you've missed some of the fundamentals, or have a clever way to do something that you can share in the comments for future visitors to the page.

Want to learn more about MEF? Watch my video series, Fundamentals of the Managed Extensibility Framework. In this edition, I build a simple application that allows the user to check a preference on the screen (whether they prefer squares over circles) and then displays a square or a circle. We use MVVM and wire everything together with MEF. Download the source code: MEFMVVMDemoSln.zip Click here to watch the video directly if it doesn't appear in the frame below (recommended to watch in full screen): Watch the video in a separate window Here is the final application:

Building a Silverlight LOB Application - Deborah's Developer MindScape. This is the first in a series of posts that will build a Silverlight Line of Business (LOB) application. This application builds a Student Management application for my company, InStep Technologies, Inc. One of the goals for these posts is to find the right level of sample code that is complex enough to be useful, yet simple enough to understand and short enough to paste relevant code.

So this example tries to keep the code as simple as possible and yet accomplish the application's requirements. These posts use Silverlight 4.0 and the Silverlight Toolkit. So if you are going to work through these posts, here are the prerequisites: 1) Download and install Silverlight 4. Visual Studio 2010 comes with Silverlight 3. NOTE: Visual Studio 2010 SP1 comes with Silverlight 4, so you don't need to download and install it separately. 2) Download the Silverlight Toolkit. This download provides many additional controls and themes. That's it. Click on a link to navigate to the desired post. Enjoy! Design Patterns - Problems and Solutions with Model-View-ViewModel. Windows Presentation Foundation (WPF) and Silverlight provide rich APIs for building modern applications, but understanding and applying all the WPF features in harmony with each other to build well-designed and easily maintained apps can be difficult.

Where do you start? And what is the right way to compose your application? The Model-View-ViewModel (MVVM) design pattern describes a popular approach for building WPF and Silverlight applications. It’s both a powerful tool for building applications and a common language for discussing application design with developers. When is the MVVM design pattern applicable, and when is it unnecessary? In this article I’ll explain how the ViewModel works, and discuss some benefits and issues involved in implementing a ViewModel in your code.

Model, ViewModel and View Every WPF and Silverlight application I’ve worked on so far had the same high-level component design. Sitting atop the Model is the ViewModel. Why Use a ViewModel? Dynamic Properties. Silverlight 4.0 and MVVM Pattern. What is MVVM Pattern? MVVM (Model-View-View Model) is the design Pattern code model used for WPF/Silverlight UI. MVVM is the guideline a developer should follows in order to achieve a more testable, debug gable, manageable, readable Application. MVVM is implemented with zero code behind. Yes, no button click event hander in the code behind file, no form/windows load logic, no UI binding logic, and no UI validation or type casting code in the code behind file. The reason we don't want to put code-behind in our project is so that one can write a unit test against the code and create instances and run methods on our instances in a unit test.

The following features are used in order to achieve the MVVM pattern with no logic on the UI code behind file and to make sure that the presentation layer and logic remain loosely couple. Before MVVM, the MVP pattern was famous for its use in WinForm and WPF applications (it never took full advantage of the two-way binding feature of WPF). Attached dependency properties for dummies. Recently I tried to make my first attached dependency property and it struck me as odd that I could find a lot of articles on dependency properties – but it still took me quite some time to piece together the how and the why. And basically they all parrot the same few samples. So I decided to try my own take on the subject. So what is an attached dependency property, then? It helped me a lot to think of an attached dependency property as being the property equivalent of an extension method. You basically attach a new property to an existing object.

Without actually modifying the object definition. What is it good for? About the same as an extension method: you can add extra properties to existing objects, without having to go trough the hoopla of inheritance. So how do you make an attached dependency property? You make a static class, in which the property is declared and 'hosted', as I call it. This is roughly the equivalent of The whole thing works by naming convention.

MVVMLight

Model-View-ViewModel (MVVM) Explained. The purpose of this post is to provide an introduction to the Model-View-ViewModel (MVVM) pattern. While I've participated in lots of discussions online about MVVM, it occurred to me that beginners who are learning the pattern have very little to go on and a lot of conflicting resources to wade through in order to try to implement it in their own code.

I am not trying to introduce dogma but wanted to pull together key concepts in a single post to make it easy and straightforward to understand the value of the pattern and how it can be implemented. MVVM is really far simpler than people make it out to be. Click here to read the Spanish version (Leer en español) Want to learn about MVVM in the HTML5 age? Why Even Care About MVVM?

Why should you, as a developer, even care about the Model-View-ViewModel pattern? Do you need to share a project with a designer, and have the flexibility for design work and development work to happen near-simultaneously? Let's examine the pieces of the MVVM pie.