Dear Designers: please put dialog box buttons in the correct order
May 11th, 2011 at 2:03 am
Windows and OS X arrange dialog box buttons differently
I see so many people making this mistake lately, even in Microsoft’s own shipping software. The order of the dialog buttons is specific to the OS you’re targeting. It is confusing to users when you switch the button order, and if they aren’t paying attention, they may click the wrong one.
On Windows and KDE
From the Windows UI Guidelines:
Present the commit buttons in the following order:
OK/[Do it]/Yes
[Don't do it]/No
Cancel
Apply (if present)
Help (if present)
This has the result of pushing “The Thing You Want To Do” toward the middle of the dialog.
OS X is different
The buttons at the bottom right of a dialog all dismiss the dialog. A button that initiates an action is furthest to the right. This action button confirms the alert message text. The Cancel button is to the left of this button
Usually the rightmost button or the Cancel button is the default button. The default button should be the button that represents the action that the user is most likely to perform if that action isn’t potentially dangerous. A default button has color and pulses to let the user know that it is the default. When the user presses the Enter key or the Return key, your application should respond as if the user clicked the default button.
On OS X (and GNOME on Linux), the “Thing You Want To Do” is near the corner of the window. Personally, I think this is more sensible, but I’ll value user interface consistency over “better” any day of the week.
New Release: ReactiveUI 2.3
May 8th, 2011 at 1:36 pm
What does ReactiveUI do?
ReactiveUI is a M-V-VM framework like MVVM Light or Caliburn.Micro, that is deeply integrated with the Reactive Extensions for .NET. This allows you to write code in your ViewModel that is far more elegant and terse when expressing complex stateful interactions, as well as much simpler handling of async operations. Check out this video for an overview:
ReactiveUI on Hanselminutes
Check out the recent Hanselminutes episode about the Reactive Extensions as well if you’ve got more time. Scott and I chat about some of the ideas in RxUI and how we can take the ideas in the Reactive Extensions and use RxUI to apply them to Silverlight and WPF apps.
What’s new in ReactiveUI 2.3 – update to work with Rx 1.1.10425
As you may have noticed, the latest version of Rx has changed quite a bit, in both the functionality and the namespace structure. The latest build is just a release to make RxUI compatible. Another fix is, that since NuGet 1.2+ fixes the support for WP7, so I’ve updated the normal packages. If you’re already using the WP7-specific packages, I’ve updated those too.
Where can I find the library?
On NuGet! The best way to install ReactiveUI for a project is by installing the ReactiveUI package for WPF/Silverlight/new WP7 projects, or ReactiveUI-WP7 for existing Windows Phone 7 projects.
If NuGet isn’t your thing, you can also find the binaries on the Github page: ReactiveUI 2.3.0.0.zip.
Where can I see a sample?
A sample project for WPF 4.0 that includes everything you need to see how it works is on the Github page: ReactiveUI 2.1 Sample.zip. It includes a small sample app, the RxUI binaries, and some sample test cases.
PSA: Parallels Shared Folders breaks IIS Express
May 2nd, 2011 at 3:12 pm
If you’re using Parallels Desktop and you’re trying to use the awesome new MVC stack (IIS Express, SQL Compact, Razor views), you’ll find something quite frustrating: you’ll get error messages to the effect of “redirection.config: File cannot be found”.
Disable Parallels Shared Folders
The cause is that files that are normally local are being redirected to network shares. Disable this in Parallels and all will be right with the world again!
ReactiveUI posts now in PDF format
April 18th, 2011 at 1:34 am
Since my blog software is rather lacking as an official document source for ReactiveUI, I’ve put together the blog posts in chronological order, cleaned them up, and compiled them into a single PDF, called “The Zen of ReactiveUI”. I’ve also created a version in ePub format, so that you can put it onto an eBook reader. If you’re interested in either RxUI, or the Reactive Extensions in general, I think the PDF is a good read – it talks about not only how RxUI works, but a lot of interesting background behind how things work.
Get the document here:
Using ReactiveUI with MVVM Light (or any other framework!)
April 4th, 2011 at 5:54 pm
ReactiveUI: Is it All or None?
No! RxUI provides all of the core components that you need to use the M-V-VM pattern, but many people already have applications written using some of the other great .NET MVVM frameworks, such as MVVM Light or Caliburn.Micro – rewriting an entire codebase just to use Rx is a total bummer.
Fortunately, in ReactiveUI 2.2, there have been several features introduced in order to make using RxUI with existing frameworks easier – you can try out RxUI on a per-page basis, instead of rewriting your whole app.
There are really three core bits that are central to MVVM: a ViewModel object, an ICommand implementation, and a change-notifying Collection. Let’s take a look at how we can Rx’ify these three items.
Using MVVM Light alongside ReactiveUI
First, File->New Project and create a new “MVVM Light” projects via the template. Then via NuGet (you are using NuGet, right?), add a reference to the “ReactiveUI” project. Now, crack open MainViewModel.cs. The critical thing to know is, all of RxUI’s awesomeness are extensions onto an interface called IReactiveNotifyPropertyChanged. Ergo, we need to make MainViewModel implement this. But don’t panic, it’s easy!
Step 1: Change the class definition to implement IReactiveNotifyPropertyChanged.
Step 2: Add a field of type “MakeObjectReactiveHelper”, and initialize it in the constructor:
public MainViewModel()
{
_reactiveHelper = new MakeObjectReactiveHelper(this);
/* More stuff */
}
Step 3: Paste in the following code at the end of your class, which just uses _reactiveHelper to implement the entire interface:
An important caveat about MakeObjectReactiveHelper
One thing that probably won’t affect you, but it might: MakeObjectReactiveHelper doesn’t properly completely implement IReactiveNotifyPropertyChanged unless you are also implementing INotifyPropertyChanging – most ViewModel implementations don’t (in fact, the interface doesn’t even exist in Silverlight or WP7). This means that in certain circumstances when you use the WhenAny or ObservableForProperty with a deep path (i.e. x.Foo.Bar.Baz), you may get duplicate notifications. In practice, this usually isn’t a big deal.
Watching ObservableCollections to create ViewModel collections
With RxUI 2.2, you can easily create a collection which tracks an existing collection, even if the source is an ObservableCollection. Here’s the syntax:
Creating ReactiveCommands like RelayCommands
Unfortunately, the story for ICommand isn’t as easy, you have to wrap commands one-at-a-time in order to subscribe to them. Here’s how to do it:
{
return ReactiveCommand.Create(cmd.CanExecute, cmd.Execute);
}
New Release: ReactiveUI 2.2.1
March 22nd, 2011 at 11:38 pm
What does ReactiveUI do?
ReactiveUI is a M-V-VM framework like MVVM Light or Caliburn.Micro, that is deeply integrated with the Reactive Extensions for .NET. This allows you to write code in your ViewModel that is far more elegant and terse when expressing complex stateful interactions, as well as much simpler handling of async operations.
ReactiveUI on Hanselminutes
Check out the recent Hanselminutes episode about the Reactive Extensions as well if you’ve got more time. Scott and I chat about some of the ideas in RxUI and how we can take the ideas in the Reactive Extensions and use RxUI to apply them to Silverlight and WPF apps.
What’s New in ReactiveUI 2.2.1 – Now with 100% less Windows Phone crashes
This release is just a maintenance release – if you don’t currently have any issues with RxUI, there is no reason to upgrade. However, there are two major fixes that were worth creating a new release for:
- .NET 4.0 Client Profile – by including System.Reactive.Testing into ReactiveUI.dll, we broke everyone using the Client profile with WPF. This is now fixed and future versions of RxUI will be built against the Client profile.
- WP7 Crashes – if you tried to use RxUI with WP7, you would receive a TypeLoadException whenever a type was instantiated, or possibly a XamlParseException telling you something to the effect of “MainWindow class does not exist”. This issue is now fixed!
Breaking Change: Introducing ReactiveUI.Testing
To facilitate fixing the first bug above, a new Assembly / NuGet package has been introduced, “ReactiveUI.Testing.dll / ReactiveUI-Testing” – this was originally in ReactiveUI Core, and the libraries here help you write better unit tests for your applications (similar to Rx’s System.Reactive.Testing). As a result of this, you may need to add an extra package / library reference to your project when you upgrade to 2.2.1.
Where can I find the library?
On NuGet! The best way to install ReactiveUI for a project is by installing the ReactiveUI package for WPF/Silverlight projects, or ReactiveUI-WP7 for Windows Phone 7 projects.
If NuGet isn’t your thing, you can also find the binaries on the Github page: ReactiveUI 2.2.1.0.zip.
New Release: ReactiveUI 2.2
February 27th, 2011 at 8:40 pm
What does ReactiveUI do?
ReactiveUI is a M-V-VM framework like MVVM Light or Caliburn.Micro, that is deeply integrated with the Reactive Extensions for .NET. This allows you to write code in your ViewModel that is far more elegant and terse when expressing complex stateful interactions, as well as much simpler handling of async operations.
ReactiveUI on Hanselminutes
Check out the recent Hanselminutes episode about the Reactive Extensions as well if you’ve got more time. Scott and I chat about some of the ideas in RxUI and how we can take the ideas in the Reactive Extensions and use RxUI to apply them to Silverlight and WPF apps.
What’s New in ReactiveUI 2.2 – Interop with Existing Code
This release has a focus on enabling folks to use RxUI without having to completely rewrite existing codebases to use ReactiveUI. In future entries, I’ll show how to take existing ViewModels and “Reactiveify” them.
Major Changes
- The ObservableForProperty and WhenAny operators now work with normal INotifyPropertyChanged-based ViewModels, instead of requiring them to be ReactiveObjects. This means it’s now easy to try RxUI in your existing project without changes.
- A new class called MakeObjectReactiveHelper can be included in your existing ViewModel classes to easily make them equivalent to ReactiveObject objects without changing the base class.
- A new overload of RaiseAndSetIfChanged is added that uses a Ref parameter to solve the Silverlight “backing fields must be public” problem.
- New testing features that work along with TestScheduler.CreateHotObservable that allow you to create mock timelines and test your code against it.
Minor Changes
- The legacy QueuedAsyncMRUCache has been removed – this is a breaking change, but you really shouldn’t be using this class, ObservableAsyncMRUCache is much better and doesn’t have correctness issues.
- Performance fixes in MemoizedMRUCache, which is used throughout the framework.
- Many bugfixes directly based on user feedback – specifically, the ReactiveAsyncCommand issue where async items weren’t being run on the Taskpool is now fixed.
A new Sample Application

A Reactive Pomodoro Timer
I’ve written a new sample application based on a Pomodoro Timer – while this application isn’t multithreaded, it’s still asynchronous, and illustrates a lot of how to use Rx in a complex user interface (while a Pomodoro Timer seems quite simple, it actually is quite tricky to write since all of the UI controls are interrelated and very prone to ordering issues). With Rx.NET and RxUI, we can write the entire interaction logic in about a page or two.
But the more interesting thing in this sample, is that all of the interaction logic is also unit-tested. Using Time Travel Testing, we make sure the application does what it says it does, without actually ever waiting on the timers to finish. Here’s an example test: despite it appearing to take time, it runs instantly (Open in Browser if you don’t see a code sample):
Get the sample on the Github page: ReactiveUI 2.2 Sample.zip.
Where can I find the library?
On NuGet! The best way to install ReactiveUI for a project is by installing the ReactiveUI package for WPF/Silverlight projects, or ReactiveUI-WP7 for Windows Phone 7 projects.
If NuGet isn’t your thing, you can also find the binaries on the Github page: ReactiveUI 2.2.0.0.zip.
ReactiveUI Message Bus – decoupling objects using the publish/subscribe pattern
February 25th, 2011 at 12:17 am
Message buses allow us to decouple code
If you’ve used the MVVM pattern enough, you’ll sometimes find that you get “stuck” – you need to access a certain ViewModel (usually the “main” ViewModel), but at the point you need it, it’s too far removed from the context that you’re using it in. Sometimes if the object is a Singleton it’s appropriate to think of something like the Managed Extensibility Framework to get a reference.
Other times, a Messaging framework is more appropriate – ReactiveUI provides an “Rx”-take on the Messenger (Publish/Subscribe) pattern. With the Messenger pattern, we don’t have to make all our ViewModels related to each other, which is important for writing testable code, since I can easily replace related objects with mock objects.
ReactiveUI’s MessageBus
ReactiveUI’s MessageBus is based on the Type of the message object. If the Message type isn’t unique enough, an extra Contract string can be provided to make the source unique.
There are three main methods that we’re interested in:
- RegisterMessageSource(IObservable source) – Register an IObservable as a message source – anything that is published on the IObservable gets published to the bus.
- SendMessage(message) – Publish a single item on the bus instead of having to use an Observable.
- IObservable Listen() – Get an Observable for the specified source – you can either Subscribe to it directly, or use any of the Rx operators to filter what you want.
Special support for singleton ViewModels
For ViewModels that only have a single instance, there are a number of helper methods that make using the MessageBus easier – use these methods instead of the above ones:
- RegisterViewModel(ViewModel) – Registers a ViewModel object; call this in your ViewModel constructor.
- IObservable ListenToViewModel – Listen for change notifications on a ViewModel object
- IObservable ViewModelForType – Return the ViewModel for the specified type
Adding a Reference inside a NuGet project
February 21st, 2011 at 11:21 pm
Sometimes packages need references to system assemblies
When NuGet packages need to reference other NuGet packages, it’s fairly straightforward to do: add a References section in your NuSpec file pointing to the right package. However, what if your package requires one of the built-in assemblies, like System.ComponentModel.Composition (MEF)? As far as I can tell, NuGet doesn’t have a way to do this in the spec file. ReactiveUI’s WP7 version needs a reference to System.Observable – trying to install the package then building it results in build errors, and that’s no way to live.
Using a post-install script to rig it up
Add a tools folder, and in that add an “install.ps1″ – this is a PowerShell script that gets run whenever your package gets installed. Here’s the magic sauce to add the reference:
$project.Object.References.Add("System.ComponentModel.Composition")
You can do all kinds of other cool things with that $project variable, use the NuGet console to explore what’s available.
New Release: ReactiveUI 2.1
February 14th, 2011 at 10:39 pm
What does ReactiveUI do?
ReactiveUI is a M-V-VM framework like MVVM Light or Caliburn.Micro, that is deeply integrated with the Reactive Extensions for .NET. This allows you to write code in your ViewModel that is far more elegant and terse when expressing complex stateful interactions, as well as much simpler handling of async operations. Check out this video for an overview:
ReactiveUI on Hanselminutes
Check out the recent Hanselminutes episode about the Reactive Extensions as well if you’ve got more time. Scott and I chat about some of the ideas in RxUI and how we can take the ideas in the Reactive Extensions and use RxUI to apply them to Silverlight and WPF apps.
What’s new in ReactiveUI 2.1 – bindings galore!
- ObservableForProperty now accepts full paths, similar to Xaml bindings – this makes it much easier to write complex expressions
- Combining properties correctly is much easier with a new Object.WhenAny() method that acts like a n-way CombineLatest optimized for binding use
- A new method called BindTo allows you to automatically update a read-write property using an Observable; this can be combined with WithAny() to easily create one-way bindings between ViewModel objects
- Improved CachedSelectMany that allows you to share a cache between different parts of the code
- Utility method ToCommand which invokes an ICommand based on an IObservable
- ReactiveUI now uses the latest Rx.NET release, and solves some NuGet issues that were present in the WP7 release
- Lots of bug fixes, especially to MessageBus and ReactiveAsyncCommand; a huge thanks to the folks on the Google Group for helping out with bug reports
Had trouble with NuGet lately? We fixed that.
Recently, ReactiveUI has been having some trouble on NuGet, with both the WP7 and Desktop packages. Hopefully all of these problems have been fixed, though you’ll have to update your existing code to be compatible with the latest Rx.NET – for me, this mainly affected the Publish() operator, but is relatively easy to fix.
Where can I find the library?
On NuGet! The best way to install ReactiveUI for a project is by installing the ReactiveUI package for WPF/Silverlight projects, or ReactiveUI-WP7 for Windows Phone 7 projects.
If NuGet isn’t your thing, you can also find the binaries on the Github page: ReactiveUI 2.1.0.1.zip.
Where can I see a sample?
A sample project for WPF 4.0 that includes everything you need to see how it works is on the Github page: ReactiveUI 2.1 Sample.zip. It includes a small sample app, the RxUI binaries, and some sample test cases.


