Category Archives

Publishing #MVVMLight V5.4.1 with .NET Standard support

.NET, .NET Standard, MVVM, Technical stuff, Universal Windows Platform UWP, Windows 10, Work, WPF, Xamarin
11 Comments

I just finally published MVVM Light V5.4.1 which is a stable version containing the .NET Standard support that was released as a preview a few months ago. It took a long time for this version to come out due to the new job keeping me busy as well as a few health issues in the family.

I am really happy to have this stable version out and about! Make sure to upgrade your packages! Pay attention to the following details:

Full list of changes

The change log is available here.

GitHub code repo

Since Codeplex is no more, I moved the code and everything else to Github.

.NET Standard

The details for .NET Standard support are detailed here, including how you can upgrade to this new version. Please note that MVVM Light for .NET Standard in a separate Nuget package named MvvmLightLibsStd10.

CommonServiceLocator

I am now supporting V2.0.2 of CommonServiceLocator. In this new version, the CommonServiceLocator developers decided to change the namespace. As a consequence, if you are upgrading, you must change the namespace section as follow:

// OLD
using Microsoft.Practices.ServiceLocation;

// NEW
using CommonServiceLocator;

Note that like before, and as mentioned here, the .NET Standard version of MVVM Light doesn’t not include the CommonServiceLocator dependency.

Thanks for your continued support to MVVM Light and Happy Coding!!
Laurent

Using the #mvvmlight DispatcherHelper in your .NET Standard libraries

.NET, .NET Standard, MVVM, Technical stuff, Universal Windows Platform UWP, Windows 10, WPF, XAML
No Comments

You might have heard that MVVM Light is now available as a .NET Standard 1.0 package, which means that you can use it in all your .NET Standard libraries (including 1.0, 1.4, 2.0 etc). Since .NET Standard is always backwards compatible, having MVVM Light running on .NET Standard 1.0 is quite convenient.

With .NET Standard, the incentive to use MVVM Light in even more applications is pretty huge, and with this the desire to use the DispatcherHelper to “translate” calls from a background thread into the UI thread of a UWP application, for instance. However as you might have already noticed, you cannot simply use the DispatcherHelper from within a .NET Standard library (nor from within a Portable Class Library for that matter). This is because the DispatcherHelper is a platform-specific component. In other words, the implementation for WPF is not compatible with the UWP or the Xamarin implementations. As a result, the DispatcherHelper class lives in the GalaSoft.MvvmLight.Platform DLL which gets added to your WPF, UWP or Xamarin applications, but NOT to your PCL or .NET Standard libraries…

The following article and sample propose a workaround. The article also details a few changes I want to add to MVVM Light to make it much easier to use DispatcherHelper in .NET Standard and Portable Class Libraries. Hopefully this will be useful!

Happy coding
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)

Share on Facebook