Archive For The “MVVM” Category

MVVM async progress meter example using the Task Parallel Library

I’ve just posted up on GitHub a quick example WPF application that shows an MVVM-style progress meter dialog, using the .NET 4.5 Task Parallel Library (TPL). Specifically demonstrating: A progress meter using .NET 4 Tasks (not BackgroundWorkers). Async support. Cancelling of Tasks via CancellationTokens. Exception handling back to the original thread. Reporting background progress updates […]

Read more »

The Fat ViewModel

If someone asked you, what are the building blocks of MVVM, what would you say? Models, Views, and ViewModels, of course. It’s in the name. But really, there are two others: Models Views ViewModels Commands Events If Commands and Events aren’t strongly represented in your application, I’d say there is a strong chance it isn’t […]

Read more »

Background event handling in Prism

Prism’s event aggregator is great for decoupling UI state changes when UI events occur, but sometimes you need to perform some larger, long-running task on a background thread — uploading a file, for example. Here’s a quick example of an encapsulated event handler listening off the Prism event bus, and using Windsor’s IStartable facility to […]

Read more »

Reactive Extensions and Prism: LINQ to your Event Aggregator

A lot of people have been talking about the Reactive Extensions for .NET, a flash new library from Devlabs which lets you do LINQ to .NET events just like you can with collections. My team at work has started using it pretty heavily, and today I wrote an adapter that allows you to use Rx […]

Read more »

Null Object pattern for a WPF ComboBox’s deselected value

Last week, I encountered a problem doing some fiddly UI behaviour in a Prism/MVVM app. I wanted something like this: FX curve: USD GBP EUR GBP I wanted a ComboBox where you can choose one of the available options, or none of them. Null, deselected, whatever. Unfortunately for me, WPF doesn’t support binding null values […]

Read more »