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…

Understanding the Portable Library by Chasing ICommand (2 of 3)

Part 1: Creating the Portable LibraryPart 2: Portability in Silverlight and WPF: a Tale of Type Forwarders (this post)Part 3: Portability in Metro: A CLR and WinRT Love Affair Portability in Silverlight and WPF: a Tale of Type Forwarders In the last post, I walked through creating a portable assembly that will target Silverlight 4.0…

Where’s my DataContext?

Every now and then a question comes up concerning a missing DataContext.  The questions usually center around a ViewModel being set to a View properly, but then developer can not bind some command or property to a FrameworkElement.  And typically the FrameworkElement in question is nested within an ItemsControl’s ItemTemplate or other similar structure. First…

Auto-Discoverable Views using Fluent PRISM in Silverlight

One reason a developer would use a technology like MEF is to, as the name implies, make an application extensible through a process called discovery. Discovery is simply a method for locating classes, types, or other resources in an assembly. MEF uses the Export tag to flag items for discovery, and the composition process then…

PRISM, MEF and MVVM Part 1 of 3: Unity Glue

PRISM, also known as Composite WPF, has established itself as a very popular framework for building modular, scalable Silverlight applications. A newer contender, the Managed Extensibility Framework (MEF), has also grown in popularity. In fact, these two frameworks have left people scratching their heads wondering which one to use, when, how, and why. Download the…

A Twist on the Twist of the Observer Pattern

Thanks to those of you who read my Twist on the Observer pattern and gave me the feedback. You said, “Hey, Jeremy, that’s neat, but there is already a pattern established for what you’re talking about, and a few great solutions ready to use. Besides, they are much, much more powerful…” Thanks to Microsoft MVP…

A Twist on the Observer Pattern

The observer pattern is well established and used. The typical scenario is to register to an class and then allow your Notify method to be called. This often involves keeping an internal list of observers and then iterating them to notify that something has changed. I had a situation recently that warranted a lighter weight…

Editing WPF Controls in Expression Blend

This is one of those quirks that until you try it, you may not know it exists or what the answer is. I am working on a WPF project and have a separate control library (actually, a module because I am using the Component Application Guidance/PRISM pattern). I pulled it into Expression Blend and was…

WPF – Animating multiple elements simultaneously

A question appeared on StackOverflow asking how to animate a property on multiple elements from one or more trigger mechanisms (i.e. a button click or list box selection).  The traditional approach (for brevity’s sake, I omitted the Xaml comprising the actual UI elements) is rather straight-forward: <Window.Resources> <Storyboard x:Key="OnClick1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock1" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00"…

Prism Presentation – Code and Slides

I recently had the pleasure of speaking at CodeStock 2009 and was very impressed with the conference overall.  The folks behind this conference put in a lot of work and did a really great job.  I got the chance to see some really good presentations as well.  I look forward to attending CodeStock in the…