Using RelayCommand and Messenger (and WeakAction) with closures

V5.4.0-alpha contains a proposed fix for the following issues:

A detailed blog post will follow soon.

Installing the preview

The preview is available on Nuget. Follow the steps:

New installation:

  • Right click on your project and select Manage Nuget Packages.
  • In the Nuget Package Manager, make sure that Include prerelease is checked.
  • Select the Browse tab.
  • Type MvvmLightLibs in the search field.
  • Select MvvmLightLibs V5.4.0-alpha.
  • Select Install.

Updating an existing installation:

  • Right click on your project and select Manage Nuget Packages.
  • In the Nuget Package Manager, make sure that Include prerelease is checked.
  • Select the Updates tab.
  • Select MvvmLightLibs V5.4.0-alpha.
  • Select Update.

Testing the new API

Messenger

If your Register method passes an Action with a closure, use the Register method with keepTargetAlive = true.

RelayCommand

If your Execute Action or CanExecute Func use a closure, use the constructor with keepTargetAlive = true.

WeakAction, WeakActionGeneric, WeakFunc, WeakFuncGeneric

If either one of these objects use a delegate with a closure, set keepTargetAlive to true in the constructor.

A detailed blog post will follow soon.